I'd see a doctor. My dad has sleep apnea and was having headaches primarily at night. I'm not saying your case is the same by any means, but headaches can come from all sorts of things, most of which are harmless. But it's still best to be sure.