By the following method, you can Unlock/Jailbreak iPhone 3G Firmware 3.1 on Windows.

1.Download Following files.

File Part 1 | File Part 2 | File Part 3

2.After you have downloaded these all three parts, join them using HJSplit.

3.Now run iTunes 9, connect the iPhone with Computer via data cable.

4.From the device menu on left side, choose your iPhone.

5.Now hold shift key and click restore and choose the IPSW file that we downloaded in step 1 above.

6.Now wait until installation gets completed.

You have done jailbreaking iPhone 3G to 3.1 Firmware. If you want to unlock your iPhone and can use with any network or SIM, follow this method.

Source : Sizlopedia