The heart attack itself did not cause your cavities. Without seeing you, I am going to guess that your doctor put you on a number of medications and one (or more) of those medications is a blood pressure medication.
You MUST take your medications, so your mouth care will need to be more involved. You will need to brush and floss two or three times a day. You will need a heavy duty fluoride toothpaste and you will need to be diligent about drinking lots of water.
There are many lifestyle changes that people make after having a major health event. A change in your oral care will be hard at first, but it will become routine- just like eating differently and exercising.