Good news! If you happen to be using the latest version of RedSn0w, you can safely update your iPhone, iPad, or iPod touch to iOS 5.1.1 without losing your jailbreak status. This has apparently been confirmed by Redmond Pie, as well as another iOS developer.
Before you go ahead and nab that newest version of iOS, however, you’ll need to download or keep a copy of iOS 5.1 handy. When you’re ready, update your iDevice to iOS 5.1.1 and then open up RedSn0w. From there, specify that it needs to use the old iOS 5.1 file, which will effectively get it to do the previous software jailbreak again. Check off the box to install Cydia too.
That’s the good news. The bad news is that this is still a tethered jailbreak, so you will need to reconnect your iOS device ever time you choose to restart it if you want to keep the jailbreak going.[Source]