Star Trek: The Next Generation: The Survivors
One destroyed planet with two people who happen to have survived, a warship that sometimes protects them and sometimes destroys them, and Deanna Troi gets a really annoying song stuck in her head. Somehow Picard pieces all this together. I think his intelligence doesn't really get it's due. Of course, how could it with Boy Genuis Wesley Crusher around?