You can always restore a device to factory regardless of whether you're on contract or not, at least until the iPhone falls off. Download the latest iOS either through iTunes or through the stickies here on iPhoneForums, connect your iPhone to your computer, put it into DFU mode, open up iTunes, go to your iPhone's tab, shift+click Restore and point it to the IPSW you've downloaded. If you want to restore to another iOS 5 or restore back to iOS 5.0.1, you'll need the SHSH blobs that correspond to those iOS's in order to do so. Otherwise, your only option is iOS 6.0.1