Should this not be Master of Dorada?
Talk about it here.
The Masters of Dorada were an advanced long-lived race. They used to be humanoid, but over many generations became giant disembodied brains with four tentacles. They were telepathic, could generate electric charges through their tentacles, and kill with a thought. They lost the organs for sight and hearing.
The Masters conquered Dorada and enslaved the native Doradans, forcing them to forced to work in underground factories while they enjoyed life on the surface. They would give the workers electric shocks if they stopped working, pleasant dreams if they went to sleep on time, and horrific nightmares if they didn't.
When the Second Doctor, Ben Jackson and Polly Wright arrived on the planet, the Masters enslaved them as well, forcing them to work in one of their factories and suppressing their memories of having lived anywhere else. They were freed by a rebel Doradan who explained to them the history of his world and asked them to kill the Masters. When they refused, he and another Doradan convinced them to do so by walking towards the Masters, who destroyed the intelligence of one and killed the other. Shaken, the Doctor and his companions shut down the machines controlling the Masters' life-processes. (PROSE: The Dream Masters)