Wholesale, unbiased assessment of Scandinavian electronic health-care databases offer a unique opportunity to reveal potentially important undiscovered drug side effects. We examined the short-term risk of acute myocardial infarction (AMI) associated with drugs prescribed in Norway or Sweden. We identified 24,584 and 97,068 AMI patients via the patient- and the cause-of-death registers and linked to prescription databases in Norway (2004–2014) and Sweden (2005–2014), respectively. A case-crossover design was used to compare the drugs dispensed 1–7 days before the date of AMI diagnosis with 15–21 days’ time -window for all the drug individually while controlling the receipt of other drugs. A BOLASSO approach was used to select drugs that acutely either increase or decrease the apparent risk of AMI. We found 48 drugs to be associated with AMI in both countries. Some antithrombotics, antibiotics, opioid analgesics, adrenergics, proton-pump inhibitors, nitroglycerin, diazepam, metoclopramide, acetylcysteine were associated with higher risk for AMI; whereas angiotensin-II-antagonists, calcium-channel blockers, angiotensin-converting-enzyme inhibitors, serotonin-specific reuptake inhibitors, allopurinol, mometasone, metformin, simvastatin, levothyroxine were inversely associated. The results were generally robust in different sensitivity analyses. This study confirms previous findings for certain drugs. Based on the known effects or indications, some other associations could be anticipated. However, inverse associations of hydroxocobalamin, levothyroxine and mometasone were unexpected and needs further investigation. This pharmacopeia-wide association study demonstrates the feasibility of a systematic, unbiased approach to pharmacological triggers of AMI and other diseases with acute, identifiable onsets.