What you have to remember is that if the PC is plugged in the plug socket but SWITCHED OFF the only connection which is still made is the earth connection. When you switch off the plug socket the Live & Neutral wires are disabled from the plug but the earth remains in tact - this is a safety feature in all homes (unless you live in the continent where sockets are double insulated and have just the brown and blue (live & neutral) wires and no seperate earth wire (you also get this in many lamps and hi fi parts etc.)
When working on the inside of a PC the safety way to earth yourself is to use an anti-static wrish strap - the professionals will even use a wrist strap which plugs into the household plug socket!
The reason for this is that you will not get a better earth than the one in your household socket so you may as well utilise this.
Whenever I play around inside my PC, I ground myself to the PC chassis and leave it plugged in but switched off at the wall. This way I'm earthed to my house earth circuit through the PC chassis.
Doesn't get mush safer than that!