2001 jeep grand cherokee brake lights

For a couple of years now, the brake lights on my Jeep have not worked correctly. they do not work when i hit the brakes. When the headlights are on and i hit the brakes, the brake lights go out. i have replaced the brake light assemblies (including the one in the rear window) & the bulbs, but the problem persists. The other bulbs in the brake light (back up, turn signal & running lights) work fine. The brakes lights though do not want to work. Please help- its driving me crazy- what is the fix for this problem?

Since you say the brake lights go out when the headlights are on it kind of hints towards a bad ground problem but you also say the other rear lights work ok. This would seem to indicate the grounding is ok since the lights share the same ground. The brake light circuit may run through the emergency flasher circuit so try cycling the switch a few times to see if that helps. If that doesn’t work then you mat have a bad connection in the power lead to the brake circuit. Using a test light probe to check the power with would help you find the trouble spot.