You were having a niacin flush. Your heart was beating fast because you were not expecting it and it scared you. The flush is a good thing. It was expanding your capillaries so you could get better circulation going. I do it occasionally just for the fun of it. Enjoy.
Also read up on it. I was told by one expert that most people top out at around 1000-1200 mg of niacin per day, and to slowly keep increasing the dose until the flushing sensation stops. In other words the capillaries will be completely clear and fully expanded at some point if you continue to slowly increase the niacin. Then your circulatory system will be working at peak optimal performance.
It sounds interesting, but I have yet to reach that point. I am still getting a rush, love it, and hate to give it up.