Actually I think Namsag is correct.
I had already gotten hold of a replacement gas valve, but after reading Namsag's post I decided to take the solenoid off the new valve and fit it to my existing valve, and hey presto it works. The main burner stays lit until the thermostat operates.
So...