I am so very sorry about the passing of your little dog. It is always hard to take, but especially when it has come as such a shock. It may have been a heart attack or stroke, yes, or it could have been a hidden spleen tumour which suddenly ruptured.
There is NOTHING you probably could have done to stop this. So please don't blame yourself. Sudden death does sometimes happen, and like Margot said, you can't know the cause of death unless a necropsy (autopsy) is done.