OK, here's what to do, assuming your phone's already on 3.0.1. If it's not, update in iTunes.
If you want to save contacts, texts, etc, back up the phone in iTunes. Then:
1. Follow this tutorial to jailbreak your phone with RedSn0w:
http://www.iclarified.com/entry/index.php?enid=4303
(
note, you must use the 3.0 firmware for this stage, NOT the 3.0.1 version.)
2. Follow this tutorial to unlock it with UltraSn0w:
http://www.iclarified.com/entry/index.php?enid=4253
3. Restore from your back up