Sorry I didn't see this earlier -
Yes! Unjailbreak your phone by restoring to 3.1.2 official from Apple. It should tell you to connect your phone to iTunes to activate. Don't do this. Give your phone to your friend, tell him to plug in his sim and plug it into iTunes. iTunes will ask him if he wants to set it up as a new phone or restore from a backup. Click restore and it'll set it up exactly like his old phone.
For him, tell him to NOT DO ANYTHING to his phone. Plug it in an sync it - but DO NOT UPDATE IT.
Once you get it, restore it to a factory 3.0 IPSW and then jailbreak using redsn0w. Install Ultrasn0w and then update using a pwnage tool 3.1.4 created 3.1.2 IPSW or just leave it on 3.0.
WHATEVER HAPPENS, DO NOT UPDATE THAT PHONE TO A FACTORY 3.1 OR 3.1.2 IPSW. IT WILL UPGRADE THE BASEBAND WHICH WILL MAKE IT (PERHAPS) PERMANENTLY UNABLE TO BE UNLOCKED. ONCE THIS HAPPENS THERE IS NOTHING YOU CAN DO TO UNLOCK IT (short of knowing people who know how to do crazy things with a soldering iron).
You got lucky here bro,
