The pain-killing properties are an extremely useful effect of sexual excitement - and not just orgasm, either.

Several months ago, I was injured at work while assisting a client who was about to fall. This royally screwed up my back and neck. I have been in a near-constant state of pain since the injury, with a few notable exceptions.

Once I was able to have sex again, the most fun of the exceptions became when my beloved and I were having sex. The endorphins that are released during sexual arousal do a wonderful job of combating the pain and muscle spasms and cramps in my back and neck. To the point that condoms have become known as "pain killers" between us.

In my experience, the pain does not return immediately after orgasm, though it certainly doesn't take very long. The endorphins stay in the body for a little while following the arousal and (hopefully) subsequent orgasm.