Experts think Viagra, and other similar erectile dysfunction drugs, improve this function. The drug, which has earned pharmaceutical firms more than £1billion a year since it was launched as an erectile drug in 1998, works by relaxing blood vessels, improving blood flow to the groin.
This function also affects the ability of the heart to pump blood, scientists think.
Experts at Manchester and Oxford universities have now shown that this has a remarkable impact on health.
The team studied the health records of 5,956 men with type 2 diabetes, aged between 40 and 89. Of that group, 1,359 took erectile dysfunction drugs called PDE5 inhibitors - of which Viagra is one form.
They took the drugs only an average of 16 times over the seven-year study period - less than once every five months.
But they were 46 per cent less likely to die of heart disease during the study period, the scientists found.
Patients taking the drugs were also 38 per cent less likely to suffer a heart attack - and those who did were 40 per cent less likely to die as a result.
The scientists, whose results are published in the BMJ journal Heart, adjusted the figures for age, blood pressure, prior heart problems and other medication use. Professor Andrew Trafford, of Manchester University, one of the scientists, said: "Diabetes is a major risk factor for heart disease so treatments that could reduce that risk are urgently needed.
"Erectile dysfunction treatments like Viagra are already licensed for use so, if trials provide further evidence of a life-saving benefit, it might be possible to start treating people with this drug in the not too distant future."
He stressed that Viagra would not work for all male heart patients, but if further trials confirm his results, he expects that it could be prescribed for many diabetics. It is not licensed for use by women, but in theory it might help female diabetics, although further trials would be needed to show it is safe for them.
Professor Jeremy Pearson, of the British Heart Foundation, which funded the research, said: "Viagra was originally being developed as a cardiovascular treatment in the UK.
"Researchers were looking at its use in people with high blood pressure and angina... so it's promising to see we may have rediscovered its potential in fighting heart disease."
Meanwhile, millions of diabetes patients could soon monitor their glucose levels with a drop of their tears instead of having to endure painful daily blood tests.
A new technique measures levels of the sugar in a tiny sample of the fluid that lubricates the eye to give a quick and accurate reading.
Currently, diabetics have to prick their finger to draw a drop of blood and test it to ensure they take insulin or other drugs at the right time.
The process, which requires several steps and can be painful, can put many patients off testing their glucose as often as they should. Failure to control glucose levels in the blood can lead to limb loss and blindness. The prototype, device developed by US researchers, features a soft foam tip that is touched to the corner of the eye close to the tear duct for a fraction of a second to absorb some of the fluid there.
Squeezing the device, pumps the fluid into a chamber where the activity of an enzyme acting on the glucose produces an electrical signal. This signal is used to calculate the blood glucose level and gives a readout on a display.
Dr Jeffrey La Belle and his team at Arizona State University in Phoenix now intend to conduct clinical trials on the Tears Touch Glucose Sensor before it is available to patients more widely. Their work is published in the journal Chemical Communications.