I have not tried this so use at your own cation. But if you want to know how to restore your iOS on your iphone or ipad but NOT lose your jailbreak, this could be for you. Now before you ask, its RESTORE. Not upgrade or downgrade. So that being said, here is SemiRestore!
SemiRestore allows you to fix your device in a respring loop or in a unusable state, without losing your jailbreak. CoolStar has been working on a SSH version of SemiRestore as well as a OS X/Windows/Linux version on which you may connect your device up via USB to semi-restore.
This supports OS 5.0 to 6.1.2. This is great for those who love to play around with various jailbreaks. If you get stuck in respring lock, which has happen to me, this will save your skin.