What you had was a panic attack. You probably smoked some good sativa and you just weren't used to its effects, which differ from the Indica you most likely have been getting(at least I mostly get indica here). Then because you were high you started to focus more on your heart beating which made it beat faster. I am no doctor but I've seen it happen way to often when someone smokes a really good sativa for their first time.