Was on my rescue course two weekends ago - as an added skill, my buddy and I had to share air at 30m. I made the mistake of dropping my reg instead of keeping it in my hand (lesson number one) - I signalled 'out of air' and grabbed my buddy's octo. As I grabbed it, it started freeflowing - by this time I really needed to breathe so I jammed it in my mouth instead of 'sipping' from it(lesson two) and took a deep gulp. All I ended up with was a lung full of SW. Up until that point, I had learned all about the theory of panicking under water and the dangers of a panicked diver either grabbing your reg from your mouth or bolting for the surface, and like many I thought - never! Believe me, at that point with a lung full of water, all I could see through the swirl of bubbles was my buddy's reg in his mouth and all I could think was how much I wanted to grab it. Like you I remembered the magic words "Stop, Breath, Think and Act" - I recovered my own reg, forgetting all about my own octo (lesson three) and forced it into my mouth. I was wretching and coughing my lungs out but all I could remember was my open water instructors words that if you have air, you will live.
Cut a long story short, I managed to cough my way through it and get rid of all the water but it was a terrifying experience and one (in a way) I am glad I experienced because now I have learned some extermely valuable lessons and also believe the theory we all learn in the classroom.