I unlocked an iPhone 2g running 3.1.3 by using Redsn0w 0.9.4 (Windows), you will need to have a copy of the ip software file 3.1.2 (NOT 3.1.3 as you might think) and the unlock files BL-39 and BL-46. Then it's all plain sailing..jailbreak and unlock in one operation.