Don't stand in the fire! The comparisons to WoW are all true. Seriously, if you have space, just stay far away and shoot him. If not, he's caught you where he wants you and you're probably going to lose. Well played, Pyro. That's what the class system is for; an opponent can engage you in a situation that favours him more than you. If you get killed every time you fight them, it's because experienced Pyros won't even bother to try and fight if there's any distance between them and their target. Most classes can afford to engage from a slightly disadvantageous position, but the Pyro can't. If he's not in flamethrower range, he won't stay and fight. He'll move into cover and try to flank, so bear that in mind.
The combat classes (Soldier, Demo, Heavy, Pyro) don't have any problem with Pyros (barring the Demo, who has a hard time if he's caught unprepared). The Scout loses if he's caught indoors, but wins if he has space to move. The non-combat classes (Engy, Medic, Sniper and Spy) have to try not to get into fights anyway. Medic and Engy should have backup (patient or sentry), and if the Spy is found out before he strikes he shouldn't expect to survive.
The combat classes (Soldier, Demo, Heavy, Pyro) don't have any problem with Pyros (barring the Demo, who has a hard time if he's caught unprepared). The Scout loses if he's caught indoors, but wins if he has space to move. The non-combat classes (Engy, Medic, Sniper and Spy) have to try not to get into fights anyway. Medic and Engy should have backup (patient or sentry), and if the Spy is found out before he strikes he shouldn't expect to survive.