I just went through dealing with this about a month ago.
My wife and I have both had our 3GS' for a little over 2 years. The last few months, the battery life dropped to almost nothing. I could take it off the charger at 100%, make one phone call, and it would shut off after a few minutes. Even if I didn't make any calls, it would drop fairly quickly to 85-90% then shut off the first time I tried to do anything other than look at it.
I ended up calling AppleCare and setting up an advance replacement to get the batteries replaced. They did put a temporary authorization of $700 on my cc, then removed it when I returned the phones.
I thought that they would take my phones, replace the batteries, then ship the originals back to me, but they just had me keep the ones they sent out. They were "re-serialized", Apple's version of refurbished, but after doing a restore from a full backup of my old phone, they look and act like new. The total cost to me for both phones was $214.
I could have upgraded with a new contract, but wanted to wait until the iPhone 5 comes out. I don't know that I'll actually get the 5, but even if I don't, the price on the 4 will come down.
Once I upgrade, we'll still have 2 "iPod Touch 32GB" for the money I paid.
Just my 2c worth...hope it helps,