Whenever Apple releases a new version of iPhone OS or iTunes, one of the most frequently asked questions by users who have jailbroken and/or unlocked their iPhone is whether it is safe to download and install them.
“3G+3GS unlockers .. you must not update to official 3.1! unlock needs pre-hacked 3.1 with 04.26.08”
iPhone OS 3.1 updates the iPhone OS as well as the modem firmware (from 04.26.08 in iPhone OS 3.0 to 05.11.07). So users who have jailbroken their iPhone and want to unlock it will have to wait for the iPhone Dev Team to release an updated version of their PwnageTool, which will allow them to update the OS without updating the modem firmware.
MuscleNerd has confirmed that Dev Team will release PwnageTool for iPhone OS 3.1 :
“PwnageTool lets you make custom-made mix+match IPSWs, so we'll be updating that for 3.1.”
If you want to only jailbreak your iPhone and don't care about unlocking; even then you are better off waiting for Dev Team to release PwnageTool as you'll end up losing your jailbreak if you update to iPhone OS 3.1 now and you could permanently also lose the option of unlocking your iPhone in the future.
He has also clarified that it is safe to upgrade to iTunes 9 even if you have jailbroken or unlocked your iPhone.
“it's safe to update iTunes if already jb/unlocked. Just don't update iPhone firmware too!”
So this should answer your questions about iPhone OS 3.1 and iTunes 9, if you have jailbroken or unlocked your iPhone.