Actually, a far better Trek reference can be found in the cheesiest episode ever: Spock's Brain
The "Givers of Pain and Delight":