Here is how I was able to remove all but 5 Satoshis from my wallet using the standard client.
I had a wallet with 0.0005 bitcoins that I could not spend because the required fee to spend it all was more than the balance.
I added 230 btc to the wallet 5 days ago. I was prepared to leave these in the wallet for a long as necessary to allow me to spend it all. But my wife watches the bitcoin prices ($42 at the moment) and she insist that I sell most of my coins now.
I subtract 0.0125 from my balance and send it to another wallet. TX
63ffefdf348ff68bced90e3cda45c1e6115e71c44ad3f8d3adfd4270f37077acThen I do an iterative process of trying to send all my coins.
balance = 0.0125, send 0.0125 -->balance too high after fee. Can't send
send 0.00000001 --> 0.0005 fee needed, resulting balance = 0.01249999, too much left don't send.
send 0.0005 --> 0.012 fee needed, resulting balance = 0.0. Sounds good but client says it isn't enough! Possible bug?
send 0.00049 --> 0.012 fee needed, resulting balance = 0.00001. Better. Don't send.
send 0.000499 --> 0.012 fee needed, resulting balance = 0.000001. Even better.
Keep repeating untill: send 0.00049995, resulting balance = 0.00000005. This is the best I can do. Hit send TX
3c51d3f8965d0bee5b647c9f3f2d8b4d85d7593fd70156af7f516e1c0982f04fEnd result: I have a wallet with 5 satoshis. It cost me 0.0235001 bitcoins ($0.99) to create.
I will never gamble again.