Anti-inflammatory drugs could cut the risk of heart attacks and strokes, a study of 10,000 patients suggests.