The authors of the Oxford University study said their findings showed that prolonged use of such medicines was "risky", but patients had to weigh up the benefits against the dangers.
Millions of people have rheumatoid arthritis and osteoarthritis, and many rely on high doses of painkillers, which are also sold in lower quantities over the counter for common ailments.
The study, published in the Lancet, found that in every 1000 people with a moderate risk of heart disease, about eight would normally have a heart attack or stroke each year.
When similar patients were given a year of treatment with a high dose of ibuprofen or a similar painkiller called diclofenac, that risk rose, and 11 patients had heart attacks.
One in three of the extra heart attacks was fatal, the study found.
The same dosage, which is the maximum normally prescribed and twice the amount allowed over the counter, more than doubled the risk of heart failure from three cases in 1000 to seven, and more than doubled the risk of complications such as bleeding ulcers.
Researchers said the study had looked at the risks from common painkillers in "unprecedented detail".
The lead author, Professor Colin Baigent, said: "For many people who take these drugs for severe arthritis, they make the difference between being able to go about their daily life or not. We are trying to say yes, they are risky, but it may be worth it."
The findings, from an analysis of 639 random trials, found that high doses of a third drug, naproxen, did not increase the risk of heart attacks or strokes.
It was found to be the most likely of the medications to cause bleeding from the stomach, but researchers said such problems were usually less serious.
Researchers said risks from ibuprofen and diclofenac were "mainly relevant" to people with arthritis who were prescribed high doses for long periods.
"A short course of lower-dose tablets purchased without a prescription, for example, for a muscle sprain, is not likely to be hazardous," said Professor Baigent.
The figures
• 8 people out of 1000 with moderate risk of heart disease would normally have a heart attack or stroke each year
• 11 people in 1000 with similar risk on a high dose of ibuprofen or diclofenac had a heart attack
- Source: Lancet