No, not stupid. Learning. About yourself, about your limits. About how to handle yourself. It does take practice to learn diplomacy.
I would say it sounds like you did a good job by walking away when you know it could have gotten worse. You lessened the damage this way. So, well done you, for that.
As you continue to practice these skills, remember that no one can make anything come out of your mouth but you. And... that a smile, and saying absolutely nothing can go a long way sometimes when someone is being what sounds like a blow hard, like your H's friend. He was trying to engage you and you were smart enough to see it coming. Now you know. Be ready next time to disarm him with your charm & wit.
You weren't stupid.