For a long time...years... I woke up with a headache which would usually clear by the time I had my shower. Sometimes not.
I do have an issue with my neck/shoulder and can only sleep on my right side, otherwise the pain starts.
I also have a hip issue and bought a memory foam knee pillow in Asda. JML I think. One evening I decided to try it as a neck pillow and have never looked back. No more waking up with a headache. It cost just under £20. This was after trying all sorts of neck pillows. My knee pillow travels everywhere with me. I'm pretty sure I've seen it advertised and a Google search would probably be fruitful.
Perhaps this morning's headache was the result of lying particularly awkwardly and does sound scary. I hope you are feeling better now.