The scientists found that only 0.7 per cent of those studied - fewer than five of the 536 men and women - had had sex in the hour before their heart attack.
In contrast, almost 80 per cent had not had sex for at least 24 hours before they became ill.
And while some 100 heart attacks, strokes and other cardiac episodes occurred in those studied in the next ten years, no link was found between the cardiac problems and remaining sexually active.
A spokesman for the Ulm University researchers, who carried out the study, said that while many heart attack patients worry about over-exerting themselves, sex is generally no more strenuous than climbing stairs or walking at a brisk pace.
Writing in the Journal of the American College of Cardiology, study author Dietrich Rothenbacher concluded: "Based on our data, it seems very unlikely that sexual activity is a relevant trigger of heart attacks."
Dr Rothenbacher also said that it is important that doctors put patients' minds at ease. He added: "Less than half of men and less than a third of women are getting information about sexual activity after a heart attack from their doctors.
"It is important to reassure patients that they need not be worried and should resume their usual sexual activity."
However, he also said heart attack survivors should be aware that some medicines used to treat them could cause impotence - and drugs to treat this could result in a drop in blood pressure.
The NHS acknowledges that many patients are concerned about having sex again after a heart attack. Its advice states: "There's no evidence to suggest that having sex increases your risk of having another heart attack.
"Once you've recovered, you're no more likely to trigger another heart attack by having sex than someone who has never had a heart attack.
"Regular exercise and physical activity are good for the heart and, for most people, continue to be recommended after a heart attack."
The British Heart Foundation says patients can start having sex again as soon as they feel well enough. This is normally four to six weeks after a heart attack.
Some 120,000 Britons have a heart attack each year in the UK. More than 900,000 of the country's 1.5million survivors are under 75 in age.
- Daily Mail