The 3GS has a pretty good DAC; better than the 3rd gen iPod Touch which is very similar in construction -- but I think Apple's phones have been getting better designs/parts than the iPods as of late. I own both the 3GS and the iPod Touch 3G and prefer the 3GS over the Touch every time for sound, both with headphone out and line out which I have both used.
For a while, I used the following product, which is an amp only (no DAC):
http://www.head-fi.org/t/527376/venturecraft-go-dap-design-ingenuity-makes-an-awesome-iphone-rig
This device is great if you want to use the 3GS for audio. It uses the line out of the 3GS, so you get the best quality. It also can charge your phone. And, it is effectively a case, so you can leave it on the device. As an amp, the device drives headphones plenty loud, perhaps everything except really hard-to-drive cans. The volume knob is very convenient. And it is cheap relative to the amp/DAC solutions -- only $99 for the black one on Amazon, fulfilled by the manufacturer. I got the red one pictured in Jude's review. Here are the two issues with it:
1) The isolation from wireless signals is poor. You will hear "dit dit dit" when the phone reacquires the network. You can turn off the phone part using Airplane mode and then these sounds go away, but then you lose the phone functionality (and effectively go private -- which might be fine for you).
2) The sound changes through the amp, losing a bit of its bass punch. I think the designers have put a low-frequency roll-off into the design which has been mentioned by others. It is not that big of a deal, but if you are a basshead, you will notice it.
Now, if you want better sound, than an LOD paired with an amp (I have a Fiio E17) sounds better than the Go-DAP for 3GS -- better bass. Of course, you've got the problem with attaching the amp to the phone (rubber bands don't work because they cover the screen). If you went this route, I'd go for a separate case like a camera belt case to hold everything.
Finally, if you want the ultimate sound, you get a DAC and an amp. Solutions start somewhere around $500 for that. The reason for the high cost is Apple certification which seems to be the gatekeeper Options are the one of the AlgorhythmSolos + separate amp, the Fostex HP-P1 DAC/amp, the VentureCraft Go-DAP X, the VentureCraft Go-DAP DD Socket 1 plus separate amp, or the soon-to-be-released Centrance HiFi-M8 DAC/amp. Be prepared to get specialized cables and such to make sure everything stays small and compact.
My suggestion: Take advantage of your 3GS' line out and go with an amp-only solution. If my 3GS had gobs of memory, this is what I would do. For me, I need more storage than what my 3GS has.