Season 20, Episode 3
Homer is offered the last lottery scratchcard at the Kwik-E-Mart but he is distracted when Bart is fooling around. Not wanting to miss the opportunity Lenny steps in and purchases it instead - and wins $20,000. Later, as Lenny hosts a party for all of his closest friends, Bart meets a young boy who bares an identical resemblence to himself and after a deal between them they decide to switch places for a short time.
The couch gag is a parody on The Wizard Of Oz.
See Simpsons wiki for more details.