I'm not familiar with your case, but I used to get this every night and couldn't understand the reason why. Here is a question that related to my trouble and may to yours:
1. How long, before you went to bed, did you eat?
If less than two hours, chances are that your digestive system is still working and is stimulating the part of the nervous system that also feeds the heart. Spicy/rich foods will compound the situation. If you were full when you went to bed, this can cause a degree of reflux from the stomach into the aesophagus, which shares the vagus nerve with the heart.
If any of the above is right for your case, there are a couple of things you can do to ease the problem. One is to drink a small glass of drinking yogurt to help calm things down. The other is to get a stack of pillows or similar to prop yourself up in bed at an angle. This keeps the stomach contents properly in the stomach, and should help you have a more stable sleep. I've found that when the stomach finishes its job, the palpitations also cease.
This is what I've learned about my problem. Hope it's useful to you.