If the tail lights work, it's probably not a ground problem. If it works as a turn signal, I would think that it is the brake switch. Unhook the wire on the side "out" side of the brake light switch and check for voltage from that post to ground with the pedal depressed.