You cannot unlock it forever cause all US iphone are locked to AT&T and neither Apple or AT&T provide official unlocking to them.
All you can do is JB and software unlock but if you ever restore or update you will lose it.
You can update to the latest 4.0.1 and then use jailbreakme.com to JB.
Then install ultrasnow from cydia to unlock.
Welcome.