Assign profiles to applications in JoyToKey. That way the Esc bind is only valid as long as Model 2 Emu is in focus, and when M2Emu closes and the focus goes back to the CF FE, JoytoKey switches profiles, and you can have different bindings or none at all. Vice versa too, obviously.
Or is that what you're already doing, and the keypresses get buffered so it goes back to windows anyway?
If that's the case, some creative autohotkey scripting should do the trick. Have a batch file launch M2Emu and the AHK script, which latter would bind a keypress to deliver a different keypress, once, and then rebind itself to nothing. Then the script closes once M2emu is dead. Might need JoyToKey to deliver the first keypress for AHK though. I find it a bit niggly, so the first option would be better if you can use it.
EDIT: Just remembered - there's a function in JoyTokey to bind 4 keys to the one button. Pressing that button four times triggers each binding once, in order, then repeat. That might help fudge it as well. I don't think there's a function to change a binding based on a press.
Can you not simply bind the key to exit M2Emu to something else, and use profiles like in the first idea?