At least I now have a working GSX, even though we do not yet understand why.
Well, strictly speaking, your GSX always worked.
The problem was that, for some reason, when you pressed a key on your keyboard, the code sent via Simconnect (as confirmed by logging it with FSUIPC) to GSX was from another key, while it worked normally when I pressed the same key remotely, from Teamviewer.
Since GSX works when changing to a different hotkey that doesn't use F12, it seems the only logical explanation left, is that some other running program, maybe not even related to FSX, has intercepted the F12 key somehow, and for some reason that program doesn't affect a remote control from Teamviewer.