Most heart palpitations are not very serious and usually don't lead to a heart attack however if the heart palpitations occur with dizziness, fainting, shortness of breath, or chest pain then you should seek medical attention.
A few things that can cause heart palpitations are atrial fibrillation and supraventricular tachycardia and if the heart palpitations last longer than a few seconds or continue to happen then it would be best to see a doctor about it just to be sure.