Yep, sounds like the switch is acting flakey. Can you swap the upper and lower limit switches to see if that works better? If not, try doing a "Home Negative" and check if that operates properly. (CAUTION: Homing to a negative Z requires careful monitoring and quick response on the RESET button if things go awry!)