How do I unlock an iPhone 3GS?
I would check the serial number (printed on the box or/if it wasn't replaced, behind the SIM tray/by entering DFU mode and checking in System Profiler or using the Identify feature in redsn0w) and, if it is old enough to downgrade its baseband, restore it to the iOS version you'll want to use° and perform the jailbreak+iPad baseband and baseband downgrade procedures.

°depending on available SHSH, of course

Seeing the poor condition of the existing system software you'll likely want to restore it anyway…