

One way of potentially restoring your unlock is to save your SHSH blobs, which is what is used to authenticate your i Phone with Apple.
This process is only possible using a downgrade, which can be a fairly difficult operation to complete (Apple authenticates all new software installs using their own servers).
If your i Phone is disabled due to incorrect passcode entry, you can use some other device – may be an i Pad or another i Phone – to check out data that has been synced to your i Cloud account.
You can login to your Apple ID via Settings → i Cloud and then sync the device to see if contacts, mail, photos and other app data are available as a backup.
Normally, when you restore your device to factory settings it will be updated to the latest i OS version (which might not have a jailbreak).