Consider Hypoxia Inducible Factor, or HIF.
HIF is one of a class of proteins known as Transcription Factors which are, basically, the on/off switches for genes. In general, they bind to a specific sequence in the beginning of a gene (although, sometimes, they also bind to the end, or somewhere in the middle as well), and initiate transcription of the gene into RNA. Usually, this mRNA is subsequently translated into a polypeptide.
HIF in particular modulates the expression of hundreds of genes in every tissue. It's basically exactly what its name sounds like. It activates during times when a tissue is oxygen-scarce and initiates a series of potentially helpful responses. Among others, it initiates proliferation of capillary beds, it modulates metabolism so that less oxygen is used, and in some tissues, drives the production of red blood cells (one of the genes which is most strongly driven by HIF is erythropoietin). Then, once oxygen tension is restored, it inactivates and disappears.
As you might guess, the activity of HIF is virtually always temporary. It activates during exercise, or times when you're breathing a thin atmosphere.
In the heart, one of the genes that HIF down-regulates, or partly turns off is called SERCA. The SR/ER calcium-dependent ATP-ase. SERCA is basically an ion pump which, at the end of every contractile cycle, pumps calcium ions into a small "bag" inside every muscle cell. The overwhelming majority of the calcium ions used in cardiac contraction come from this bag. Without this calcium, contraction doesn't happen, and the strength of contraction is approximately proportional to how much calcium is contained in this bag. This, effectively, makes SERCA a "gatekeeper" protein for energy use in the heart. One of the effects of adrenaline on the heart, for instance, is to make SERCA work harder, thereby pumping more calcium ions into the reservoir.
SERCA also happens to be one of genes which is most strongly downregulated by the action of HIF. Because it is so tightly linked to energy use, it's a perfect target if the goal is to conserve energy for a brief period of time.
In most cases where Hypoxia Inducible Factor is active in the heart, this is a very, very good thing. HIF turns on for a few hours, limits the energy consumption of the heart until oxygen delivery is restored, then shuts off, and SERCA returns. In the short term, this extends the "buffer zone" in which the heart can restore oxygen tension.
In a heart attack, this is a very, very bad thing.
When an artery is occluded, HIF has no way of knowing whether the oxygen shortage is because of a blockage, or because you went for a long jog. In either case, it does exactly the same thing. It forms new capillaries. It reduces your dependence on aerobic metabolism, and it drops SERCA in order to reduce energy demands. And if you'd been out jogging, rather than suffering a heart attack, all this probably would help. In the case where an artery is occluded, especially if it's occluded far from the hypoxic tissue, growing new capillaries will do nothing to increase oxygen delivery to the heart. As a result, there's nothing to shut HIF off. It keeps working and working, trying to restore oxygen tension.
Then things start to get bad.
As hypoxia deepens, HIF effectively shuts off the production of SERCA protein, and it basically vanishes. At this point, for all practical purposes, the heart could no longer contract, even if blood flow were restored. Basically, HIF takes a bad situation, and makes it much, much worse.
There's a very simple explanation in evolutionary terms why such a detrimental mechanism would evolve. Heart attacks are, for all practical purposes, invisible to natural selection. In all but a few rare cases, heart attacks occur long after humans reach reproductive maturity. Since natural selection can only select factors which will enhance or decrease the probability that a given organism will reproduce, heart attacks are basically impossible for natural selection to act upon. However, a mechanism which allows human beings to run longer, climb higher, and survive temporarily hypoxic environments would have an obvious selection benefit. In laymans terms, natural selection would select for the benefits of HIF action, and completely ignore the detriment.
But, for the sake of argument, let's posit that an all-powerful, all-knowing, intelligent entity built the HIF pathway all at once. It is basically impossible to escape the conclusion that God deliberately designed this pathway to kill people who have heart attacks. Remember, when God put this pathway together, She knew that this mechanism would be detrimental to the millions who suffer from myocardial infarctions every year (since She's all-knowing, and all), and She built it anyway. She designed a process which would dramatically increase human suffering down the road.
So, I feel it's worth asking: why does God hate people who have heart attacks?