I am so sorry for your sad
loss! What a horrible tragedy!
The only way that you can determine what went wrong is to have a post-mortem performed on your dog's body, in which the pathologist can find out if there was any anatomical problem, such as dilated cardiomyopathy, which could have caused a heart attack, and/or the pathologist could also perform blood work, such as a toxicology screen, checking for toxins, or poisons.
Good Luck, and let us know the findings!