If you have iTunes 9.1 (older version of iTunes) make sure you keep a copy installed in some other PC. Just in case, if you have to restore your iPhone, you can use it to get back onto 3.1.3 (specially 3GS ones) and not accidentally upgrade to iOS 4.0