I have also known the overheat to cause this problem, there will be 2 black wires coming from the thermocouple to a small button stat on the pipe on the left hand side of the boiler, try giving this a gentle GENTLE tap with the handle of a small screwdriver before re-lighting the pilot.
if this does not work try replacing the overheat stat before going for the gas valve, it is a lot cheaper.
gary.wright53@googlemail.com
March 2008