Star Trek: The Janice Lester Incident

The Constitution-class Federation starship USS Enterprise NCC-1701, commanded by Captain James T. Kirk, arrived at Camus II, responding to a distress call from a Federation survey team there. The leader of the survey team was Dr. Janice Lester, an old flame of Captain Kirk's from Starfleet Academy. Lester had come to despise Kirk because he was able to achieve what she never could: command of a starship! When Captain Kirk and Dr. McCoy beamed down, they found out that most of Lester's party had passed away and that Lester herself seemed to be on the verge of death.
But Captain Kirk learned, too late, that Dr. Lester had apparently faked her illness--and killed her own staff--to lure Kirk into a trap. Lester had found an alien device capable of swapping minds between two individuals. Before Kirk could figure out what was going on, Lester knocked him out and transferred her consciousness into Kirk's body and Kirk's consciousness into hers. At long last, Lester would be the captain of the USS Enterprise! But, in order to hold on to this hard-won victory, she needed to take care of one final detail: kill Kirk!
But Dr. Lester did not fool Mr. Spock, Captain Kirk's first officer. He knew that something was amiss. When Dr. Lester began behaving erratically, Spock found out that this was not the captain. So Spock relieved Lester of command and turned the Enterprise back to Camus II. Spock reversed the mind transfer, causing Captain Kirk and Dr. Lester to go back to their own bodies. Dr. Lester was very angry at the end. She screamed "NOOOOOO!" and she was arrested, charged, and taken to Elba II, where Garth of Izar was.