This evening (after Shabas in the nine days), I recited havdala over a cup of beer, as every year. I knew it was beer, but, by force of habit, recited "hagafen" (the wine benediction) over it during havdala. I continued, reciting the (correct!) benedictions over the spices and fire, and then began the final, havdala benediction, during which I realized my error.
Not knowing what to do, I completed havdala, sat down, recited "shehakol" (the beer benediction), and drank. What should I have done? (There are multiple issues here: Do I drink the beer? If so, do I first say shehakol? And do I have to repeat havdala?)