This sort of issue is one reason to not flatten images, and to ensure that all of the work you do is on it's own layer. If a workflow calls for the layers to be flattened I usually do I think it's called a Stamp Visible, or something similar. The shortcut key combo is Ctrl(Cmd)+Shift+Alt+E. This creates a new layer that contains the image as it was previously visible, which has the same effect as flattening the layers. Although it is not a perfect work round for a major cockup it is very helpful. I use it a lot when I want to add a High pass sharpen to an image, as you simply hit the key combo, run the highpass filter on the newly created layer and set the blend mode to Overlay, or if you want differing levels of effect, Soft/Hard light. The amount of sharpening can be adjusted with the layers opacity slider, and a layer mask, with a copy of the image that has had Find edges run on it to limit the sharpening to just those edges. If you then need to go back and make an adjustment further down the layer stack you can, very often you won't even need to change the High Pass layer, and if you do, it can be real easy to copy the layer mask to the new High Pass layer. I hope you don't need to ask how I know this
.
Alan