What is the best way to toggle a mouse-driven UI overlay?

Is the focus being set back to the SViewport widget? If so, I would put a breakpoint in SViewport::OnKeyboardFocusReceived and/or FSceneViewport::OnKeyboardFocusReceived. You want to make sure that the FSceneViewport version of the function is getting hit and returns an FReply that would set the Viewport state correctly. Obviously this all depends on WidgetFocusedBeforeMe getting set up to point at the SViewport, but I believe that should be working correctly.

Please try those breakpoints and let me know what you find.