I had a similar problem with my ZJ 4.0. Strange intermittent electrical problems to include the starter not shutting off. After much trouble shooting to include ignition switch replacement I found the ground wire from the battery to the fender was fried. I replaced the wire with a heavy cable and haven't had a problem since.
95 ZJ 4.0L 3 inch Lift
99 XJ 4.0L 4 inch Lift