I don't know if I could add something that hasn't already been mentioned, but my best advice is to stay calm and patient. You have to think and act like the enemy; your disguise isn't enough.
Because the cloak takes so long to recharge, only have it on you when you need to infiltrate an area or right after you backstab somebody and other enemies are watching. Unless enemies already know you are a spy, NEVER cloak or disguise when in the line of sight of an enemy. Don't even disguise while cloaked; if I am correct, the smoke still appears around you.
Change your disguises often. Not necessarily in a single life, but over the course of the game. However, it is a good idea to be a defensive class when penetrating deep into the enemy lines and an offensive class when you are hanging around enemy offensive classes. I prefer the demoman, soldier, and engineer.
Being a scout is bad due to the speed difference. Being a spy is bad because enemies will suspect "friendly" spies that are not immediately disguised. Being a medic is bad because if you are not constantly healing to get your uber up something is wrong.
Also, when you infiltrate, generally avoid areas that have a lot of combat and people moving around. If you bump into someone, you are in trouble.
When sapping buildings, take into account how well engineers are guarding them. If there is only one engineer and many sentries, run around and place your sappers. Usually engineers become overwhelmed and can't decide between killing you or your sappers quickly enough. If a sapper is destroyed, place another one. Of course, if there are an adequate number of engineers guarding buildings, do your best to sap as many as you can before your death. If you are lucky, you may be able to cloak or escape before the engineers arrive. Don't attack the engineers if you are in the line of sight of a sentry. Sometimes, if you are fast enough, you can backstab an engineer and put the sapper on a sentry if the sentry is facing away from you. In general, always know your surroundings.
When destroying an enemy offense, always approach from behind and act like you are part of the offense. Hang back, but always move around. Don't spaz out either when backstabbing; be certain that you will make the kill because if you miss, chances are you will die. Try cloaking and leaving if you can. If an enemy medic is healing you, don't be stupid and immediately rush for the backstab. I have noticed that if an enemy medic discovers that he/she is healing me, he will stop at nothing to hunt me down. If you are really lucky, an enemy medic will uber you. It happened to me before. Getting ubered as a spy isn't too helpful since you will lose your disguise after a kill but it prevents the medic from using the uber elsewhere.
While I'm on it, let me give some advice to medics. Never heal a friendly spy in disguise. I've seen it happen before. Seriously, you know that something is wrong when the ubered medic is one color and the color of the person he/she is ubering is different.
When disguising, note how the enemies are acting towards you. If they are staring or shooting at you, just move normally. Sometimes enemies take some shots at me and leave. Remember that you cannot run through enemies, so you have to find the right balance. Again, put yourself in the shoes of an enemy. You can usually save yourself by leaving the base going towards your own base. Even though this is opposite the direction you want to go to, people will think that you are not a spy.
Also, if you are about to run into a crowd of engineers, don't disguise as an engineer. More likely than not you will have the same name as one of the engineers and they will know. Disguise as a demoman or something.
The pistol is a very powerful weapon. Only use it if you are alone with an enemy or you have been identified as a spy. Aim for the head, obviously. Also, keep your distance if you are facing a class like a pyro. Accuracy is most important.
Also, if you want to have fun, but not necessarily live for long, get a spray that says "is not a spy" or something like that. It is not particularly useful unless the person that sees it is really stupid. Sometimes they have videos on YouTube that involve spy sprays. Check this out: [ame]http://www.youtube.com/watch?v=29RE0blCV84[/ame]
Well, this is the advice I can give you now. Enjoy and good luck being a spy!