Poor thing.
Don't take this the wrong way.. but why wasn't he on a preventative other than the type of pill that made him sick?
It's a horrible thing for a dog to have to go through. My mom has a dog who has heartworms (she rescued him, and he had them when she got him) and he is on so many medications. Sometimes he even randomly passes out.