If you have a jailbroken iPhone, iPad or iPod Touch running the latest software, you can upgrade to iOS 5.1.1 without fear of losing your jailbreak. According to RedmondPie, you can update to iOS 5.1.1 and still have a jailbroken phone, provided if you use the latest version of RedSn0w. This has since been confirmed by another iOS developer.
Allow your iGadget to update to the latest version of iOS 5.1.1, but afterwards, download or keep iOS 5.1 handy (you can still get it from Apple if you don't). Open Redsn0w and make sure you specify it needs to run the iOS 5.1 file--essentially, it's repeating the previous software jailbreak.
You also need to make sure Redsn0w installs Cydia too (there's a checkbox for that!). That's it - you're done! It's worth noting that this is a tethered jailbreak, and you will have to tether your iOS device every time you perform a restart.
It's pretty good to know developers will always have your back, even when Apple releases an unexpected update. Get the full list of instructions, and links to the Redsn0w tool, over on Redmond Pie.