Happy Birthday, Grandma Frump - S2-E22
Continuity mistake: As Morticia and Gomez play with the train, there is only one train on the set. When Gomez blows it up at the bridge, there is a second train in the midst of it. This is a reuse of stock footage.
Answer: Basically from what I understand, they stuck the innards of a small flashlight into the base of the bulb and put a little switch on it. When he put it in his mouth and bit down, his teeth would hit the switch, which would turn on the flashlight and made the bulb light up.
TedStixon