The Big Bang Theory Season 3 Episode 16
The Excelsior Acquisition
When Stan Lee is coming for a comic book signing at Stuart's comic book store, the guys are all excited to go until Sheldon finds out he's scheduled to be in traffic court that day. Apparently the day Sheldon had to drive Penny to the hospital for her dislocated shoulder, he ran a red light and Penny gave up his name when the camera caught her. At traffic court, Sheldon belittles the judge, is found guilty and in contempt of court.
After spending a few minutes in jail and told he had to pee in a stainless steel toilet in front of the other inmates, he apologizes to the judge and comes home, but it's too late. The guys already got to see Stan Lee and evne go out for gelato with him after. Penny decides to make it up to Sheldon by getting Stan Lee's address from Stuart (in exchange for being his date at a wedding). Penny takes Sheldon to Stan Lee's unanounced and Sheldon gets the autograph he wants... on a restraining order.