This is a macro script requested in the ScriptSpot forum. First to say, Kostadin Kotev already filled that request with his SubObjectModeToggle script.
My quick version (Undo SubObject Level) is a bit more simple, and probably not match strictly David request, but I beliеve it's more than simple and allows everybody to grasp the idea behind and calibrate the code to his personal needs.
The nut here is the Swap function I used to do 2 operations at once - store current SubObject Level (SOL) to a variable and restore the previous SOL state stored in those the same variable.
Well, too much words for so simple tool, right? I'm sure that after trying it you'll find out for a no time what it do and how it works ;) To test the script after running it once, open your Customize dialog and assign a keyboard shortcut, i.e. follow usual macro script installation procedure. And have fun ;)