It was in The Brain of Morbius. Classic Philip Hinchcliffe / Tom Baker monster era.
The Doctor has always been a bit mysterious, for instance did we ever find out his dark secret from the old time, the time of chaos, that Lady Peinforte threatened him with in Silver Nemesis?
That was from the Brain of Morbius, when the Doctor enters a 'mind bending' competition with the powerful mind of Morbius. During that he shows us and Morbius 8 faces that were supposedly prior to Hartnell.
https://tardis.fandom.com/wiki/The_Doctor_(The_Brain_of_Morbius)
Blimey, fair enough. I don't remember that and I would definitely have watched it. I knew the limit on regenerations was set by the Time Lords and wasn't a biological limitation. (Although if it is limitless I'm not sure what Rassilon was looking for in the Five Doctors? The imposed legal limit stopped Time Lord immortality).
Still don't like them being this all-powerful figure with mental super-powers though.