and, why "heart attack?" I don't understand.
I think that what the op might mean to say is that the headstall had a critical malfunction that a very inopportune time. That is to say, the whole thing came off the horse's head.
I've heard of it happen before, and I can't imagine that it must have felt like when it happened. I'd have had a heart attack too!
The perfect horse isn't always the perfectly behaved or trained horse. Sometimes, the best horse is the one that makes you earn that perfect ride. Work for it, don't give up, and listen to what your horse is telling you.