It sounds like electrically coupled inductive noise - this means extra phantom pulses in the wiring, causing axis drift.

Always start all debugging with the simplest state.
Leave only the fault axis motor connected, and start running programs.

Try to geta a state/program where the error show up quickly.
Now start adding more axis, spindle motor, spindle on/off, etc etc.