Will erasing all data and settings affect my previous upgrade? I’ve just erased all data and settings in my iPhone 3GS. I’ve upgraded to the latest iOS (6.0.1) before that. Will erasing all data and settings affect my previous upgrade?
No. The OS updates exist apart from any user data that would (or would not) get cleared by an erase all content and settings operation.

A restore will also restore the same OS as was on the device unless iTunes both sees a newer version of the iOS and you have told it to upgrade to that newer OS. Anything you do on the device in terms of resetting and erasing will not revert an iOS update or upgrade.