I immediately thought of blood pressure as well, or possible weak walls of blood vessels in your brain which could have some very serious impacts. I don't want to scare you and I'm not qualified to say anything about this. I think you'd be better off speaking to a professional about this than listening to what people on a forum say.
I did find this web site from the Mayo Clinic about headaches that occur leading up to or at the moment of orgasm:
Sex headaches - Symptoms and causes
I suggest talking to a doctor.