I'm sorry you're going through this.
Do you have or have you had heart issues in the past?
I suspect you have some sort of strange sleep disorder causing this. I just googled 'sleep disorder, heart feels like it stops beating' and came up with a bunch of forum discussions and the like on the subject so whatever you're got, you're not alone. Here's a link to that google page:
https://www.google.com/search?as_q=s...pe=&as_rights=
I have a crazy sleep disorder where I start flopping and twitching as I doze off, or when I get really sleepy. I know it has something to do with low magnesium so I am very diligent to make sure I get enough, but it also seems to be triggered by stress. I've had this for years now, and it has made my life very stressful as it's kept me up all night at times so I feel for you.