My turn to play doc
Your doctor is right. Migraines can be caused by sex and orgasm. The overexertion of an orgasm can very much cause a headache, and you will often find orgasm (or some variation) as a trigger of a migraine on lists of you snoop around websites. You'll be okay. The only unfortunate worry you may have is the anxiety that having an orgasm may bring since it's causing you headaches. Other than that, you should be all good.