Make sure it's in low gear !
if something is amiss with the shifter, cable The shift lever or the comb/detent in the trans . If it pops into high the brake doesn't work or hold, even if the the solenoid and valve body are working properly. So verify that it's in low gear in the trans.
Had simular problem due to a mismatched shifter/ shift lever. Car would occasionally pop in to high gear and leave as soon as I stomped the gas while I had the button held down?
Very frustrating as you well know.