This is rarer than you might imagine. It is not listed in Statsguru or any of the common reference books on cricket oddities. It has happened only three times in Tests, the third instance being in the ongoing Test between India and New Zealand at Kanpur.
A full list of instances in first-class cricket is given here:
TWM Latham was dismissed for 95 in the first innings.
KS Bharat had not played Tests earlier. Besides the stumping, he also took 2 catches as a substitute.
————————————————————————————————
See Steve Lynch’s comments in his column on 30 Nov 2021:
———————————————————————————————-
Note:
These are the only 3 cases in Tests when the wicket-keeper was not a member of the playing XI.
There are numerous other instances where members of the playing XI acted as wicket-keepers when the nominated keeper became unfit. There are as many as 54 instances when these substitute keepers took catches. And 16 instances where they took stumpings:
Interestingly, the only two Indian players here are Manjrekar senior and junior.