Tim,
Something that you can try is to insert some basic code into the file such that at some points in the program you can check to see where the Z is.
By doing that you will find if the loss of position is random / repeatable, if progressive, etc.
The Z axis must be repeatable and steps per unit accurate,no backlash, etc. as those kind of things can add up in a large
program. They really show their ugly head when you do 3D work.
One culprit I delt with was inadquate Z axis torque such that the acceleration was not adequate for the small incremental moves in the quick time required when doing 3 D work. You can try lowering the max velocity and accel of the X & Y along with feed rates but keep the Z at higher values, values that will not cause skipping. Skipping can occur and one would not know it......the axis can go off on it's owne or steps can be lost and total loss of position dosn't occur.
My fix was was a new stepper motor and rework of the Z axis.
Just some thoughts,
RICH