You can't update automatically through iTunes. It will install 4.0.2 which patches jailbreakme.
What you have to do is download the iOS 4.0.1 ipsw file.
Direct
download for iOS 4.0.1 (Official from Apple)
Do a complete backup and transfer all your purchases to iTunes. Updating will delete all apps on the device. You can transfer them back afterward as long as they're in iTunes though. A complete backup, not just syncing. Right-click on the iPhone in iTunes, and select Back Up.
Tell iTunes to install the downloaded file instead of downloading the newer 4.0.2. Instructions for that are here:
http://www.techpetals.com/how-to-loa...indows-mac.php
It will say verifying with Apple, but that's all legit, don't freak out. That part scares people.
After you load the 4.0.1 firmware, you can restore from the backup you made before hand. That gets all your settings, contacts, calendar, accounts, apps in iTunes, etc.
Open Safari on the iPhone, and go to jailbreakme. com. Sliiide.
Open Cydia.