If you mean the least underrated as in how effective they are, scout.
After practice, sometimes I win 5v1s as scout vs multiple heavies, scouts, etc and barely get touched in the end, because if you're good, it's impossible to hit you
If you mean the the most hated relative to their power, heavy.
Honestly, too strong imo, and only scouts, spies, snipers, and other heavies can beat them.
Scout: Too fast to aim at
Spy: Buttsecks
Sniper: Headshot
Heavy: Fight fire with fire

If you mean the least underrated as in how effective they are, scout.
After practice, sometimes I win 5v1s as scout vs multiple heavies, scouts, etc and barely get touched in the end, because if you're good, it's impossible to hit you
If you mean the the most hated relative to their power, heavy.
Honestly, too strong imo, and only scouts, spies, snipers, and other heavies can beat them.
Scout: Too fast to aim at
Spy: Buttsecks
Sniper: Headshot
Heavy: Fight fire with fire

Oh Captain My Captain

As a heavy main, I'll go with heavy for the following reasons
1. His minigun (and other primaries) can deal insane amounts of damage in close quarters combat (Compare: Pyro and scout)
2. He has secondaries that allow him to support his team, slap that medic in the face with a piece of raw meat or a chocalate bar (Compare: Sniper and Soldier
3. His melees gives himself the support and in other cases, negates the one of the two downsides he has, being big and slow, by increasing his speed at a cost, so self support melees (Compare Medic, Spy, Demo, Engie)
4. Most health in game
And the most important one, is hoovy. But be warned, do NOT under any circumstances attack one of these creatures

Medic:
Despite medic being the 'support class' using the ubersaw and medigun together is an insane mix. Not only can you survive in fights for a very long time with uber and the health regen, but also, the ubersaw does a lot of damage to enemies too. Medic op af.

W+M1 is really underpowered at the moment, the only type of W+M1 that I call out for being pure autism is the Phlog crits W+M1, either than that the Force-a-nature and Heavy can easily kill them with high damage, and knockback on the FaN's part.

British Quality Gentleman

I'd have to choose Heavy mainly because most people (including myself sometimes) find Soldier's slightly better mobility, more reliable DPS and team-buffing weapons to be more appropriate in tanking situations.

As a Scout main, I can say that Scout isn't actually an underrated class, but he is an underestimated class. Due to his low health, you'll often find Soldiers, Demoknights and sometimes even Heavies rage in chat when a Scout solo picks them off.

Pyro is definitely not underrated. There's so many Pyros in every match with too many people who abuse his broken features or just the volume of players with a lack of skill. Although, I certainly hate Pyro substantially less after the Reserve Shooter was nerfed and the Dragon's Fury came out because I personally think that the Dragon's Fury is the only flamethrower that actually requires skill.

If you mean the least underrated as in how effective they are, scout.
After practice, sometimes I win 5v1s as scout vs multiple heavies, scouts, etc and barely get touched in the end, because if you're good, it's impossible to hit you
If you mean the the most hated relative to their power, heavy.
Honestly, too strong imo, and only scouts, spies, snipers, and other heavies can beat them.
Scout: Too fast to aim at
Spy: Buttsecks
Sniper: Headshot
Heavy: Fight fire with fire