Finally, I have Jailbreak my iPhone 3.1.2 which was Jailbroken via Blackra1n to the latest Apple iOS 4.0 and Jailbreak with Pwnage Tool 4.0.1. You may click any of the articles below:
I followed closely this below articles:-
I have to create the custom ipsw twice to get the Cydia working. The first one crashed because I have enabled and downloaded some sources during the Pwnage process.
(Note: Ensure to “uncheck” the “Activate iPhone” because mine is officially unlocked)