That's so scary I am so sorry that happened! Sending good thoughts.
FWIW, it sounds very similar to how my friend's son would react when he would eat rice (severe allergy). About 3 hours after he'd eat the rice, he'd start throwing up so much that he'd turn blue and go lifeless. They avoided feeding him rice for 3 years and he eventually grew out of it, but the reaction was eerily similar to what you described.
I'm so sorry. I would have frozen in panic but it sounds like you handled it amazingly, given the circumstances. Lots of good thoughts that everything is ok!