You want to sell your jailbroken/unlocked 3GS, but you want to sell it with iOS4 loaded. Here's some steps that worked for me and hopefully that work for you as well. Some background: Black 32GB iPhone 3GS, purchased on Launch Day iBoot 359.3 Firmware 3.0.1 Baseband 04.26.08 SHSH on file with Cydia Done on a MacOS 10.6.3 13" Macbook Pro iTunes 9.2 To ensure that none of your personal data can be recovered, you should always do an Erase All Content and Settings. The problem with this is that it will wipe out your entire iPhone, iOS included. As per Dev Team, in order to update a 3GS to iOS 4.0 and have it jailbroken, you must upgrade from a previously jailbroken device, which therein lies the issue. I performed the steps outlined below with the iPhone and specs outlined above. YMMV but I hope this helps. 1. Erase All Content and Settings on your iPhone 3GS. 2. With iTunes Closed, edit your Hosts file (C:\Windows\System32\drivers\etc\hosts on Windows or /etc/hosts on Mac OS X) and enter this on the bottom line: 188.8.131.52 gs.apple.com 3. Use Pwnage Tool 3.1.5 to create a custom firmware for 3.0 (7A341). If needed, download Apple's firmware from: http://modmyi.com/wiki/index.php/IPhone_Firmware_Download_Links#4.0 4. Place iPhone in DFU Mode (http://www.iclarified.com/entry/index.php?enid=1034) and press Option key while clicking Restore. 5. Select your 3.0 Custom Firmware. 6. Jailbreak with redsn0w 0.92. 7. Use Pwnage Tool 4.0.1 to create a Custom Firmware with iOS 4.0 (8A293) 8. Follow step 4. 9. Select your 4.0 Custom Firmware 10. Open Cydia and download ultrasn0w 0.93, when prompted, press button to Reboot Device. 11. Insert SIM card of your choice for testing and power off your iPhone by holding the Home and Power buttons for 3 seconds until the "Slide to Power off" screen is shown, then turn your iPhone on again. 12. Sell your iPhone 3GS with confidence knowing your personal data is wiped, but your iPhone is still jailbroken/unlocked.