Doctor Who: The Mind of Evil
Episode 5
S1 E5:
The Master forms an uneasy alliance with the Doctor so that between them they can subdue the Keller Machine which is now out of control.