No real knowledge of boilers but your fault fascinates me...
The problem seems to be connected with the main gas valve - reluctant to open and shuts off too soon.
Either you have two faults - (1) slow to open and (2) closes before it should - or you have one fault that is causing both of these symptoms....
Your statement "the main gas can be switched on" confuses me slightly. I guess you mean the boiler itself switches on the gas valve rather than a person doing it.
I suspect you have just one fault but that's mainly a guess in the hope for your pocket and a quicker solution.
If the solenoid valve were "sticky" it may explain a reluctance to open, as would an issue with failing to sense the correct pilot light operation - you do have a healthy pilot flame I suppose. But neither of these would explain the other symptom of shutting down prematurely.
A poor connection in the circuit that controls the main gas valve could explain both fault conditions. This might be in the wiring, wiring connector blocks, the solenoid itself or the control board.
Wiring is relatively easy to check - tapping and wriggling.
The solenoid itself more difficult and costly so this is best left until last.
Many people suspect the control PCB in boilers and quite a few suffer from poor joints - a poor joint on your circuit board may explain the fault and would be relatively easy to detect and repair.
If you are tempted to take it out for inspection take a digital camera picture of the wiring to give you confidence in putting it back.
Good luck... Apologies for such a long reply from an unqualified person...
Peccavi
January 2009