Unfortunately I don't have any insight into this. Perhaps it may be something that needs to be addressed at a sleep clinic? This may not be sufficient to address the difficulty you're having; however here's a link to an article, from PC's archives, on how to eliminate recurring nightmares:
How to Eliminate Recurring Nightmares
You might also consider signing in on PC's sister website: NeuroTalk to see if anyone there might have some ideas with regard to this. (There is a forum on NT dedicated to sleep as well as one related to headaches.) Here's a link just in case you're not familiar with it:
NeuroTalk Support Groups