In case you haven't heard, AT&T started officially unlocking out-of-contract iPhones for customers in good standing earlier this month. The only problem is that AT&T recommends a full restore at the end of the unlocking process, which will wipe an existing iPhone jailbreak.
Luckily you can still unlock your iPhone through official channels without losing your jailbreak by following a few extra steps. When your contract with AT&T ends and you're ready to unlock your iPhone for use with other carriers, first follow the steps at this link to contact AT&T and determine your eligibility.
When the unlock is confirmed, you will receive an email explaining that you must back up and restore your iPhone to complete the process. Backing up your iPhone might be a good idea, but there's no need to restore completely for the unlock. Simply follow these instructions to preserve your existing data and jailbreak:
1. Download the latest version of redsn0w from iPhone Dev-Team.
2. Run redsn0w on your computer and connect the iPhone via USB.
3. Follow the steps in redsn0w to put the iPhone in DFU mode.
4. When redsn0w recognizes your device choose Jailbreak.
5. Options will appear with checkboxes. Make sure the only box checked is Deactivate then click Next.
6. Your device will flash words on the screen then reboot.
7. After the iPhone reboots, open iTunes on your computer.