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.