Is this something that has happened more then once? You could be drinking to much energy drinks but this might be something you want to talk with your doctor to see what is causing this. I hope this helps.
It sounds as though you may have developed a sleep disorder, with your heart palpitations occurring in your sleep. In some cases of sleep apnea, people have stopped breathing and then woken up to palpitations.