I always had the impression that the Pyro is just by far, the hardest class to learn, but the one that pays off the most if played with perfection, it is pretty much a wild card. The thing is, at medium range, the pyro is limited to the airblast and its secondary weapon, so, if his enemy doesnt fire projectiles, he can only use its secondary weapon, and that puts the pyro in a tough situation, choosing between flares and the shotgun, the flares have great potential to finish off running enemies, specially if they are already on fire, but its hard to aim and has one of the most punishing reload times, meanwhile, the shotgun is a pretty solid medium range weapon, and since the pyro is the class with more HP that can use the shotgun (soldiers have a speed disadvantage and are likely to use their primary, with can be countered with airblasts; Heavies are not to be fought head-on at medium range with any class), he can easily defend himself from his enemies with it, but his enemies can easily escape an encounter. From long range the pyro cant fight back, flares may be able to throw off an sniper but its just not worth the risk, to make up for that, the pyro is the only class with average speed that can tank an average bodyshot and a quickscope headshot AKA 150 damage.
TL;DR: In theory, the Pyro is the most balanced class and is unbeatable in his territory as long as he picks his fights, but his best offensive tactics are hard to pull off 100% of the time.
I also think the Pyro's pretty viable. You have to be Korean and/or a god to melt faces on the competitive scene, but it's pretty easy to stomp on the average pub.
Granted, I've seen Pyro players do some amazing things on the pro circuit, but it's still pretty difficult to pull that stuff off consistently.