Here's how I got an iPhone 3G I inherited from my sister to work like an iPod Touch. (So much for Apple's legendary ease of use -- this took me an hour to set up.)
Note that I don't care about the phone, speed, features, lost data, or having the latest version. I just want to access the internet with wifi.
1. Put any SIM card in your iPhone and connect the iPhone to your Mac.
2. Download PwnageTool 2.2.1
3. Run it, following the instructions here. If pwnagetool can't find your firmware, download 2.2.0 from here, and select it using "expert mode".
The whole thing takes about an hour, and I am not guaranteeing anything, but it worked for me.