Yes, the vit D may have caused it. I had similar reactions on vit D myself; palpitations and jitteryness /insomnia.
Probably due to it increasing the calcium uptake, hence lower the magnesium.
Naturalnews had a good article about it; http://www.naturalnews.com/029195_magnesium_vitamin_D.html
"This is creating some uncomfortable 'Side Effects of Vitamin D' that are actually symptoms of an induced magnesium deficiency! Some of the magnesium deficiency symptoms being attributed to Vitamin D are:"