Not all TPK's are the same
There are a few important variables in a TPK.
First is related to the encounter that causes it. Was it a random encounter or planned? Was it appropriate to the skills and resources of the party, or was it overpowering? Was the encounter the result of player specific decisions or scripted into the adventure?
A planned and overpowering TPK will probably result in the players beating the DM to death. A random encounter that is also overpowering and ends in TPK will also likely result in a beating for the DM. Both are very bad. A planned overpowering encounter is in and of its self not a bad thing, but a risky thing. Just be certain to leave your players an out, and give them a few opportunities to use that out.
But if you give your playes the map to the hoard of a great wyrm dragon when they are 3rd level, and they wander in and get eaten, then its the players fault.
One rule I would stand by though, is that under no circumstances should a trap result in a TPK. Having the entire party squished in a room with crushing walls is just dumb.
The second is related to the campaign that the TPK happens in. A one off adventure that has a TPK is no big thing. A campaign that is more action then story has a better chance of surviving a TPK then a story heavy campaign. A campaign that is only recently started, or has mostly casual players can also surive a TPK, since its likely no one is really attached to the characters that much.
I have had only one encounter that resulted in a TPK. And it was a perfectly Just TPK.
The players had ambushed a patrol belonging to a powerful Orog warlord, and decimated it. They tied a surviving bug bear to a tree, knocked its teeth in, and carved a message into its chest, challenging the Orog (Ogre / Orc half breed) warlord to "an honorable 4 vs 1" duel. They watched the area, and another patrol found the message, and left a written resopnse at the same location a few days later, telling the playes that Rourc (the warlord in question), accepted.
The players approached the camp, which had a few hundred humanoids in it, and were escored un harmed into the wardlords presence. Rourc was large, well muscled, and well armed and armoured. Rourc allowed them to prepar there gear. In a memorable, and prophetic bit of dialog, the following was said.
Rourc: Hmm, your not wearing armour? Are you a mage?
Mage: You will find out.
Rourc: You will die first.
The fight started. The players were about level 7 or 8. Rourc was 15th level and had some weapon specializations for his axe (2nd ed Combat and Tactics stuff).
Rourc dropped the mage in his first full attack. The players got worried.
Rourc dropped the dwarf in the 2nd round. The players got very scared.
The party tank and the rogue hammered away. The theif was desparate, and used called shots to his face. The tank also had over powered armour and had a huge AC. They got lucky, dropped him. High fives were going all around. Then I told the players the following.
"As you cut off his breast plate and ravage his belly with your Dagger Rourc dies. As he dies, he starts laughing. As he laughs, he fades from view. You still hear the laughing. Rourc steps out from his tent with a small man in blue robes at his side. 'That was funny. Allow me to introduce me to my friend. This is my illusionist. What kind of fool do you take me for? You are all very stupid. An honorable 4 vs 1 Duel? I am an Orog Warlord. What the hell makes you think I would fight honourably, let alone in an honorable 4 on 1 duel. You dont become the master of an army of blood thirsty goblins by being honourable.'. He looks to his side and utters the simple command 'kill them'."
At this point, my players chased me from the apartment, and I had to jump out a window to avoid a bit of a beating. Luckily, it was a first floor apartment. A few minutes later, the game resumed.
The party had all failed saves vs illusion. The fight had been run using Rourc's actual stats. Those that fell were allowed system shock rolls to survive. One failed and stayed dead. Then the fight started again, this time as a very non-honourable 500 vs 3 duel.
In the end, I did not kill them. The party was defeated, humiliated, and left tied to a tree with Rourcs mark carved into their chests. There were no hard feelings about it, and it is probably my favorite single encounter that I can recall running.
END COMMUNICATION