All four of those classes have a certain style to 'em that works great. For Pyro, just try to get a lot of people on fire; don't worry so much about sustained fire, that stuff sticks nicely. Also realize that people will run from a Pyro like nothing else. The intel could be right between your legs and they'll back the hell off. Excellent if you've got a cluster of people. Makes wonderful panic. If you see a medic, TORCH HIM GOOD! He can heal anyone else's flames, but can't heal his own.
For Spy, it just seems best to try to blend in with the other team, find defensive structures sans engies, and sap 'em, or lone defenders (snipers) and shank 'em, and the biggest thing, DON'T STARE AT PEOPLE! That's the biggest spy tell is when you just stare at someone like "do they know I'm a spy? will they turn around?" Guaranteed to get you perished.
Heavies are very simple. For D, find either a room that's nice-sized but not huge, and blast anyone walking into it (friend or foe, in case of spies), or of you prefer offense, team up with a medic or two and go on a killing spree rampage. If you uber against a sentry-engy combo, try to aim in this order [dispenser, engy, turret]. The dispenser will give the engy all the metal he needs as well as heal him, and the turret will crack like an egg under a steamroller after the engy is gone.
Medic is probably the easiest class to play acceptably (more of a science playing to its fullest, but that takes a lot of practice and trial & error); just find someone getting hurt and heal 'em, also try to stay away from pyros. Save your uber for when either you're about to die and lose it anyway, or when there is someone nearby going on the offense against something tough, like a sentry-hammering engy.
That's my two cents, at least. Other people might find different play styles work better, but this seems to work best from what I've seen.