jailbreakme.com works up to 4.0.1.
Apple is no longer signing the SHSHs for 4.0.1, so you're going to have to be especially careful.
BTW, do not upgrade to 4.0.2. You will not be able to jailbreak. The dev team is not releasing any jailbreak until 4.1, minimum.