There is a Dump Valve solenoid , #14 in the illustration, located at the LH side of the rear axle housing, behind the fuel tank, that may be sticking from dirt in the valve or in the electrical connector, BUT does not make a lot of sense why the shifter would kick it back in gear.
Just brainstorming what else can cause this.
Also, is your battery charged and htip top shape?