is there any way i can carrier unlock my iphone 2g on ios4

it was originally from america on at&t and when i use itunes to upgrade it always says invalid sim card

i have the latest ultrasnow and can download the 4.0 or 4.01 firmware

will this carrier unlock or should i not change from 3.1.2