12th level PCs? versus 50 hobgoblins? I'm sorry. That is a matter of a spell or two. I've played in and run a lot of games. This is how that would play out against a typical 4 PC 12th level party (druid, wizard, rogue, barbarian).
The hobgoblins are hiding in a forested region where they can be spread out, use cover and get a good shot at the PCs. They want the best chance of hiding, so each of them takes 10 on their hide check for a 13 hide result. The rogue, with max ranks in spot and no wisdom bonus, will likely spot them from a great distance - his spot check 30 feet + (10' X d20). This will be a very long throw for the standard hobgoblin javelins ...
After warning his allies quietly (which the hobogoblins will be unable to hear from that distance), the druid begins casting. The hobgoblins might throw some javelins ... or not. It doesn't really matter. They'll need 20s to hit. 2 or 3 might make contact for 10 to 12 damage.
The druid finishes his spell (a 5th level spell - SNA V) and summons a large air elemental which proceeds to whirlwind and begin sucking up the hobgoblins. It can go 20 squares this round. Let's say that it just reaches them without getting any in its whirlwind. The hobgoblins attack back by throwing their javelins. They need 18s to hit, so about 7 of them will connect. Of course, most of those deal no damage due to the DR 5/-. The elemental takes a few points of damage.
The rogue, druid and barbarian pick a few off with arrows and slings. The wizard and his familiar argue over whether they should waste a fireball on them and decide to ready an action to fireball the first collection of 15 or more that form in a small area.
Then, the elemental goes. It can move 40 squares. Can you say 'Hoover?'. 10 to 20 hobgoblins die in its whirlwind. The druid gets bored and kills a pair with his sling.
At this point, the hobgoblins are down to 1/2 their numbers (or less) and would likely flee. The air elemental would easily pick them off. The archery and slings of the druids would get more. If they happenned to group up for a massive charge, the wizard wastes a fireball to end them.
A spell ... or perhaps two. A few points of damage. That is it.
Even if the entire party went melee (except the wizard, perhaps), the battle would only last a few rounds and the party would only absorb a few hundred attacks, each with a 1 in 20 chance of connecting for 4 or 5 average damage. 40 or 50 total points of damage. One mass cure light will clean that up.
Could the battle go worse for the PCs? Yes. Would it be likely to do so? No. I've used these types of battles often. Few of my campaigns go by without some massive war breaking out. 50 beat humanoids are just nothing compared to the simple power of a 12th level party.