So the original question is "what would you have done?" Echoing the above in general, I wouldnt have allowed myself to get increasingly uncomfortable, then leave to get water, then wait 30 minutes after the door mysteriously locked.
We can never know the actual dynamic since none of us were there, but if what you are describing was happening exactly as you explained it (the guy trying to sort of exclude you) I'd have probably called a stop if it started annoying me.
What may have happened is, because you started out by watching, the guy maybe figured you were just a voyeur and actually didnt want a 3 way but was tolerating you there since you are the husband.
What was the dialogue that lead up to the encounter? Im a very direct kind of guy and a big believer in communication. If you met the guy and said "hey, its your lucky night, we would love for you to join us in a threesome" then the guy is an asshole based on how you describe his behavior. But if there was minimal communication and you just let things flow naturally into that room and started out by purely watching and then tried to jump in, I can see how there could have been a misunderstanding. Did you talk after you called a halt? Did the guy seem surprised and ask what was wrong?
My thinking is be clear up front, be clear during and if something goes wrong, be clear

Never "just figure". "Just figuring" is bad. Sex is emotionally charged under any circumstance. Being very clear before the libido can go off the deep end can keep things from getting unnecessarily dramatic.
Certainly dont let this put you off single guys in general. I mean why would it? This guy *may* have been a jerk, but you can run into a bad couple also.
Yikes! Just realized how old this thread was before the bump

Well still a good topic anyhow