Most likly a safty switch, I would test the switch mounted at the bottom of the PTO leaver, the switch is not easy to get too, unplug the switch and put a jumper wire in the conector and try it, if it is the switch replace it, don't leave the jumper in the conector.
The stop solenoid has 2 wires going to it, when cranking the engine both wires have 12 volts at them pulling the plunger into the solenoid, when the engine starts and the key is turned back to the run position 1 wire has 12 volts and is enough to hold the plunger in. If a safty switch is bad then the 1 wire looses power killing the engine.
It could also be key switch or timer/relay, most likly PTO safty switch.
Paul
June 2009