The idea for Ricky to pull the stocking over his head and look grotesque came from Lucy's real life. One Halloween, friends of Lucy and Desi's came to their house wearing stockings over their heads, and Lucy was scared stiff at the sight.
Originally, the bald party was the episode's last scene, not the torture treatment. After this episode was filmed, Jess Oppenheimer didn't think the bald party was funny enough to end the show, so some new sequences were shot and the episode was re-edited to put the torture treatment at the end. The original ending has Ricky call Lucy and say that he saw an old picture of himself from 15 years ago, and that he has just as much hair now, if not more, than he did back when the picture was taken.
The inspiration for this episode, specifically the "torture treatment" part came from I Love Lucy head writer/producer Jess Oppenheimer, who went through the same upset and the need to use odd anti-bald machines/devices when he first started losing his hair. Oppenheimer actually tried out the odd-looking device that Lucy had massage Ricky's eyebrows.