Sleep apnea, anxiety or heart problem?

I wake up randomly from my sleep with my heart racing and its always at the same time around 12:30! How can i seem to not be able to go to sleep before 12 or my heart will race....someone help please explain