"Spock's Brain" by Gene L. Coon (under the pseudonym Lee Cronin)
A strange ship approaches the Enterprise. A woman beams onto the bridge. She touches a band on her wrist and everyone goes to sleep. When they wake, Spock's body is in sickbay - without his brain. McCoy estimates they have 24 hours to get it back. (My limited biology says the body can't survive without a brain, but hey, he's a Vulcan.)
Kirk has Sulu track the ion trail of the ship. They lose it near a system with 3 class M planets, none of which appear capable of sending out that ship. The planet with no tech and still in an ice age has some kind of regular power fluctuations, so Kirk decides to check there. The scene of them all around the viewer debating the planets is actually pretty good.
Kirk, Scotty, Chekov and 3 redshirts beam down and are attacked by cavemen. They run when one is stunned. When he wakes, he tells them of the Others, "givers of pain and delight," but he has no idea what a woman or female is.
A cave full of food and supplies is obviously a trap for males. Chekov and the 2 redshirts stay at the cave entrance while Kirk and Scotty, joined by McCoy and Spock's body (on a remote control), spring the trap. The whole room descends and they are met by another women, Luma, who reaches for her bracelet. Kirk stuns her and removes it. When she wakes, she has no idea what they're asking her about and seems to have the mind of a child. Meanwhile, Scotty futzes with the communicator, eventually picking up Spock's voice! He doesn't know where he is.
The woman who was on the ship (Kara) arrives and knocks them out with her bracelet. When they awaken, they're in a chamber and have belts on. The women don't understand their questions. Kara says she's the leader but eventually it comes out that there's a "Controller" they aren't allowed to see. Kirk even goes so far as to flatter and then try to force her. Then she activates the belts and they're in intense pain.
[Side note: For decades, I've used "Brain and brain! What is brain?" whenever I or someone else does something bogglingly stupid.

]
We get a log from Sulu in the command chair! Very cool.
When Our Heroes awake, they're alone with 2 big male guards. Kirk, Scotty, and McCoy have a cute little exchange and then fight the guards, knocking them out. They connect with Spock again and have him send a signal that they trace to the Control Room, where Spock's brain is in a box. Kara is also there and activates the pain belts, but Kirk fights through it and uses the remote to have Spock's body deactivate the belts and remove her bracelet. They find out that Kara used "The Teacher" to remove Spock's brain, a device containing all the old knowledge of her people. Kirk forces her into the device and she instantly changes demeanor. (Kudos to Marj Dusay for the transformation.) However, she refuses to help put Spock's brain back.
Taking a big chance, McCoy uses the Teacher and starts putting Spock back together. However, this thing was meant for an alien brain, and he starts to lose the knowledge partway through. (Kelley does a nice job with this part.) He reconnects Spock's speech center and Spock talks him through the rest of the surgery (seriously?).
Kara is afraid her people will die without the controller. Kirk encourages her and says the Federation will help for awhile. (He says they'll need to move outside. Why can't they just bring the men inside?)
All fixed up, Spock starts going on about the civilization that used to be here. McCoy says he should never have connected his mouth and Kirk and Scotty laugh.
It's a deeply silly episode, but everyone plays it straight so once I bought into the premise, it was watchable and even enjoyable in places. I can see why Gene Coon used a pen name.
