Situation 1: A Black Dragon has been plaguing an area, and he lives in a trap filled cave. Deal with him.
Situation 2: You have been tasked by a nearby country with making contact with the leader of the underground slave resistance of an evil tyranical city state, and get him to trust you.
Situation 3: A huge army of Orcs is approaching the city, and should be here in a week or so. Help the city prepare for war.
Okay, so, here we go.
Tier 6: A Commoner. Situation 1: If he's REALLY optimized, he could be a threat to the dragon, but a single attack from the dragon could take him out too. He can't really offer help getting to said dragon. He could fill up the entire cave with chickens, but that's probably not a good idea. Really, he's dead weight unless his build was perfectly optimized for this situation (see my Commoner charger build for an example). Situation 2: Well, without any stealth abilities or diplomacy, he's not too handy here, again unless he's been exactly optimized for this precise thing (such as through Martial Study to get Diplomacy). Really, again his class isn't going to help much here. Situation 3: Again, no help from his class, though the chicken thing might be amusing if you're creative.
Tier 5: A Fighter. Situation 1: If he's optimized for this sort of thing (a tripper might have trouble, though a charger would be handy if he could get off a clear shot, and an archer would likely work) he can be a threat during the main fight, but he's probably just about useless for sneaking down through the cave and avoiding any traps the dragon has set out without alerting said dragon. Most likely the party Rogue would want to hide him in a bag of holding or something. Once in the fight if he's optimized he'll be solid, but if not (if he's a traditional SAB build or a dual weilding monkey grip type) he's going to be a liability in the combat (though not as bad as the Commoner). Situation 2: As the commoner before, his class really won't help here. His class just doesn't provide any useful tools for the job. It's possible (but very unlikely) that he's optimized in a way that helps in this situation, just as with the Commoner. Situation 3: Again, his class doesn't help much, but at least he could be pretty useful during the main battle as a front line trooper of some sort. Hack up the enemy and rack up a body count.
Tier 4: The Rogue. Situation 1: Well he can certainly help get the party to the dragon, even if he's not totally optimized for it. His stealth and detection abilities will come in handy here, and if he puts the less stealthy people in portable holes and the like he's good to go. During the combat he's likely not that helpful (it's hard to sneak attack a dragon) but if he had a lot of prep time he might have been able to snag a scroll or wand of Shivering Touch, in which case he could be extremely helpful... he just has to be really prepared and on the ball, and the resources have to be available in advance. He's quite squishy though, and that dragon is a serious threat. Situation 2: With his stealth and diplomacy, he's all over this. Maybe not 100% perfect, but still pretty darn solid. An individual build might not have all the necessary skills, but most should be able to make do. Situation 3: Perhaps he can use Gather Information and such to gain strategic advantages before the battle... that would be handy. There's a few he's pretty likely to be able to pull off. He might even be able to use Diplomacy to buff the army a bit and at least get them into a good morale situation pre battle. Or, if he's a different set up, he could perhaps go out and assassinate a few of the orc commanders before the fight, which could be handy. And then during the fight he could do the same. It's not incredible, but it's something.
Tier 3: The Beguiler. Situation 1: Again, getting through the cave is easy, perhaps easier with spell support. And again, if he's really prepared in advance, Shivering Touch via UMD is a possibility. But he's also got spells that could be quite useful here depending on the situation, and if he's optimized heavily, this is going to be pretty easy... Shadowcraft Mage, perhaps? Or Earth Dreamer? Either way, he's got a lot of available options, though like the Rogue he's somewhat squishy (and that Dragon won't fall for many illusions with his Blindsense) so he still needs that party support. Situation 2: Again, with his skills he's all over this one, plus the added ability to cast spells like charm makes this one much easier, allowing him to make contacts in the city quickly while he figures out where this guy is. Situation 3: Like the Rogue, he can get strategic advantages and be all over the Diplomacy. He's not quite as good at assassinating people if he takes that route (though sneaking up invisible and then using a coup de gras with a scythe is pretty darn effective), but using illusions during the fight will create some serious chaos in his favor. A single illusion of a wall of fire can really disrupt enemy formations, for example.
Tier 2: The Sorcerer. Situation 1: It really depends on the Sorcerer's spell load out. If he's got Greater Floating Disk, Spectral Hand, and Shivering Touch, this one's going to be easy as pie, since he can just float down (and carry his party in the process) to avoid many traps, then nail the dragon in one shot from a distance. If he doesn't he'd need scrolls with the same issues that the UMD Rogue and Beguiler would need. If he's got Explosive Runes he could create a bomb that would take out the Dragon in one shot. If he's got Polymorph he could turn the party melee into a Hydra for extra damage. If he's got Alter Self he could turn himself into a Skulk to get down there sneakily. Certainly, it's possible that the Sorcerer could own this scenario... if he has the right spells known. That's always the hard part for a Sorcerer. Situation 2: Again, depends on the spell. Does he have divinations that will help him know who's part of the resistance and who's actually an evil spy for the Tyranical Govenerment? Does he have charm? Alter Self would help a ton here too for disguise purposes if he has it. Once again, the options exist that could totally make this easy, but he might not have those options. Runestaffs would help a bit, but not that much. Scrolls would help too, but that requires access to them and good long term preparation. Situation 3: Again, does he have Wall of Iron or Wall of Stone to make fortifications? Does he have Wall of Fire to disrupt the battlefield? How about Mind Rape and Love's Pain to kill off the enemy commanders without any ability to stop him? Does he have Blinding Glory on his spell list, or Shapechange, or Gate? Well, maybe. He's got the power, but if his spells known don't apply here he can't do much. So, maybe he dominates this one, maybe not.
Tier 1: The Wizard. Situation 1: Memorize Greater Floating Disk, Shivering Touch, and Spectral Hand. Maybe Alter Self too for stealth reasons. Kill dragon. Memorize Animate Dead too, because Dragons make great minions (seriously, there's special rules for using that spell on dragons). Sweet, you have a new horsie! Or, you know, maybe you Mind Rape/Love's Pain and kill the dragon before he even knows you exist, then float down and check it out. Or maybe you create a horde of the dead and send them in, triggering the traps with their bodies. Or do the haunt shift trick and waltz in with a hardness of around 80 and giggle. Perhaps you cast Genesis to create a flowing time plane and then sit and think about what to do for a year while only a day passes on the outside... and cast Explosive Runes every day during that year. I'm sure you can come up with something. It's really your call. Situation 2: Check your spell list. Alter Self and Disguise Self can make you look like whoever you need to look like. Locate Creature has obvious utility. Heck, Contact Other Plane could be a total cheating method of finding the guy you're trying to find. Clairvoyance is also handy. It's all there. Situation 3: Oh no, enemy army! Well, if you've optimized for it, there's always the locate city bomb (just be careful not to blow up the friendly guys too). But if not, Love's Pain could assassinate the leaders. Wall of Iron/Stone could create fortifications, or be combined with Fabricate to armour up some of the troops. Or you could just cast Blinding Glory and now the entire enemy army is blind with no save for caster level hours. Maybe you could Planar Bind an appropriate outsider to help train the troops before the battle. Push comes to shove, Gate in a Solar, who can cast Miracle (which actually does have a "I win the battle" option)... or just Shapechange into one, if you prefer.