Troublesome Brake Light Issue

If your sockets are molded into the housing they can loose ground.
This can be tested by touching a ground (trunk latch on the body works good) and touch the other end to the bulb socket itself.
Of course you have to have someone hold the brake while you do it, or stick something on the brake pedal to hold the brakelights on.