Don't touch the wires going to the motor!

What you need to identify are the two wires within the ribbon cable, that send the step/dir signals to the stepper driver.
The most reliable way, may be to remove the Z-axis driver, disconnect the ribbon cable from the board, and then using a multimeter set to ohms, identify what pins on the IDC connector (where the ribbon cable plugs in), are connected to pins 9 & 10 for the driver.
The manual for the G251 drive can be found at - http://www.geckodrive.com/g251x-rev-9

However that's assuming the board isn't doing anything other than passing the step/dir signals straight through to the stepper driver. Is there any chance of a photo of the other board the ribbon cable connects to?