cblaisd, you have an iphone 3g?
You might need itunes 9.2. Anyway, take a backup and let it restore to 4.0.1.
Then, when it's back up, open safari and go to jalbreakme.com
But, with the 3g, there are some reports of problems with iOS 4.x, so you might want to wait. Apple acknowledged it is investigating.
If you have the 3gs, it's basically the same process.
-David