I'd leave it on the lowest kernel frequency as that is inherently the most stable.

Maybe the fans are causing interference in the step/dir inputs ... seems unlikely but you never know. Shielded cable might be the answer, but I reckon there must be more to it.

Try EMC? If that works you know the computer is ok.

Have you definitely wired the optocouplers the right way round on the driver?

(Would type more but I'm going out for the day, now ... hence why I'm up early! Hmm, 800th post.)