Those with “excess” levels of the vitamin in their blood were 2.5 times more likely than those with normal levels to have atrial fibrillation (AF), a type of heart flutter common in old age which can lead to stroke.
More than a million people in Britain are thought to have AF, the vast majority over 70.
The results, presented this week at a meeting of the American Heart Association, are perhaps most concerning for post-menopausal women, who commonly take supplements of the vitamin with calcium to help fend off osteoporosis.
Vitamin D is essential for bone growth and cellular health. The body naturally manufactures it when the skin is exposed to strong sunlight. However, in winter reserves can drop due to lack of sunlight, so many people take supplements.
However, baseline levels vary considerably, both between people and over the seasons, meaning some could unnecessarily be topping up.
Researchers at the Intermountain Medical Centre in Utah looked at blood tests from 132,000 of their patients.
They found those with vitamin D levels above 100 nanograms per 100ml, were 2.5 times more likely to have AF as those with normal levels (41-80ng/100ml).
Dr T Jared Bunch, a heart rhythm specialist, said patients should always tell their doctors what vitamins they were taking.
He said: “Patients don’t think of vitamins and supplements as drugs. But any vitamin or supplement that is touted as ‘healing’ or ‘natural’ is a drug and will have effects that are both beneficial and harmful.
“Just like any therapy, vitamins need to be taken for the right reasons and at the right doses.”
Doctors have increasingly recognised vitamin D’s crucial importance to overall health, helping to fend off not only osteoporosis but also multiple sclerosis, heart disease, diabetes and certain cancers.
They have also realised that many people in Britain now suffer from vitamin D deficiency, due in part to increasingly indoor lifestyles, with GPs seeing more children with rickets.
Doctors now advise that all people over 65 should take regular supplements, as should children up to five, pregnant and breastfeeding women, those who do not get enough sun and people with darker skin.