Ok, for starters, take everything I say with a grain of salt, because I do not have very much experience with cdi's, and no experience whatsoever with ktms.
First step. get a brand new sparkplug and try that. If that doesn't help, disconnect the kill switch.
Disconnecting the lights should not affect the spark circuit. But, since they did fool around with the wiring, you should probably find a wiring diagram (from the manual if you have one, if not, check the internet.) and make sure all of the wires for the spark circuit are connected properly, and that none of the other wires are connected to the spark circuit (When my uncle and I first got my honda running, it would die after a few seconds. turned out that when the previous owner stripped the lights he connected the power wire for the lights to the power wire for the spark circuit. Since that wire bypassed the points, it wasn't sparking right). After that, I would find any and all ground wires, (for the cdi and the ignition coil) and take a piece of sand paper to the connecter and the frame. If it still isn't fixed, start twisting, pulling, and bending the wires. If the spark suddenly cuts out or comes back when you do something to a wire, you've got a bad wire that needs replacing. If all the above steps fail, your problem rests in a faulty part. There are some tests you can perform on the primary coil and ignition coil, but I doubt they are the same as the ones for my (OLD) bike, so you'll have to check in the manual. As for the CDI, I believe you have to take it into a shop with special diagnostic equipment. Either that or borrow one from somebody with the same bike ;)