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.
Abnormal heart rhythms may be caused by the caffeine. If the drinks contain guarana which itself contains caffeine or ginseng which boosts the effects of caffeine can compound this effect.