A kill switch (which im guessing the "thumb switch" is) has a simple function. It grounds the ignition so no spark can be produced.
Some bikes have 2 wires leading to the kill switch. One wire comes from the (hot) ignition and one wire is a ground wire, connected to the engine block perhaps through the frame..
The switch connects these two wires together, "grounding" the ignition and killing the engine.
Other bikes have only one (hot) wire going to the kill switch. When the switch is activated, the body of the switch makes contact with the frame (and through it the engine block) so it grounds the hot wire, killing the engine.
Both systems do the same thing..they ground the ignition.
I am gonna guess that your broken switch sometimes makes contact and some time doesn't.. Maybe a wire is exposed and vibrates and touches something.. So sometimes the engine sparks and runs and sometimes it won't.
Fix the switch. Or, remove that switch and secure it's wire(s) so they don't short the ignition whenever they feel like it.