Length can also be an issue. If it hurts right away when you put it in, it's a lube/foreplay issue. If it hurts only when you have gotten in a few inches, it's a length issue. You might be bumping into her cervix, or another sensitive area. This can be helped with longer foreplay also.
But I think the most likely thing is, she hasn't had sex in a while. Vaginas need to get used to sex and will hurt if it's been a while. Just keep your sessions short and gradually build up as she gets used to it. She'll also adapt to your particular size and shape. At least that's how it works for me
I'm glad you were able to recover your erection. Don't feel bad about it. No one would dream of thiking badly of a woman who needed more foreplay and rerlaxation before sex; it's accepted as normal. It should be no different for a man! If it happens again, just do the same thing--wait it out, relax and have fun until it comes back.