Could the difference be whether or not a tool is selected before the print job is started or not?
The first T0 command comes after the M221 in the gcode file. Perhaps the cases where it's not sticking are the times where the tool is deselected when the job starts.