Survivors after a myocardial infarction (MI), especially those with diabetes mellitus (DM), remain at high risk of further events. Identifying and treating factors that may influence survival may open new therapeutic strategies. We assessed the impact on prognosis of DM and hypovitaminosis D (hypovitD), alone or combined. In this prospective, observational study, 1081 patients were enrolled surviving an MI and divided into four groups according to their diabetic and VitD status. The primary end-point was composite of all-cause mortality, angina/MI and heart failure (HF). Secondary outcomes were mortality, HF and angina/MI. During a follow-up of 26.1 months (IQR 6.6–64.5), 391 subjects experienced the primary end-point. Patients with DM or hypovitD had similar rate of the composite end-point. Patients with only hypovitD or DM did not differ regarding components of composite end-point (angina p = 0.97, HF p = 0.29, mortality p = 0.62). DM and VitD deficiency had similarly adjusted risks for primary end-point (HR 1.3, 95%CI 1.05–1.61; HR 1.3, 95% CI 1.04–1.64). The adjusted HR for primary composite end-point for patients with hypovitD and DM was 1.69 (95%CI 1.25–2.29, p = 0.001) in comparison to patients with neither hypoD nor DM. In conclusion, DM and hypovitD, individually and synergistically, are associated with a worse outcome after MI.