Glad you got it sorted.
The outer sleeve is the ground for the bulb. Internally, it has two filaments, a lower power (higher operating resistance) filament for the tail lights and a higher power (lower operating resistance) filament for the brake or turn lights. Both filaments are grounded to the outer sleeve, which in turn has to be securely grounded to the car body.
The whole "ground" thing tends to be confusing, the term itself is a holdover from when electricity was poorly understood. On a car, it refers only to the custom of using the car body (and frame) as one of the conductors for an electrical circuit. You still must have a complete circuit from one side of the power source (battery) through the load (the filament) and back to the other side of the power source.
Those two filament bulbs are also confusing; if one bulb is not grounded but power is applied to only one filament, the current flows through both filaments in series and back to ground through one of the other bulbs. Thus you can wind up with a lamp that seems to work when only a single function is tested, but then goes out when both functions are being tested.