See wxQueueEvent for safely posting an event from a secondary thread to an event handler, to be handled in the main thread.
wxQueueEvent
Examples using it are in samples folder of wxWidgets. One is samples/thread/thread.cpp.
samples