For quantum cryptography and quantum computing, an isolated two-state system is required. A spin-split state in a sulfur vacancy in MoS2 may be suitable for this purpose. We show that an electron can be trapped for many seconds in such a vacancy, affecting the current along a nearby path, which exhibits random switching between two current states. The coupling to the vacancy can be varied using a magnetic field, implying that this could eventually be controlled by a gate, to load and then isolate the system.