The ill-starred Test at Cape Town might well be the first one in which a captain was dismissed in the middle of a match and a replacement named immediately. Statisticians will record Smith as captain since he was “appointed captain” for the match even if he did not end the match as captain. There have been numerous cases when a captain was absent from part of the match due to injury or illness and someone else acted as captain for the remainder-perhaps as much as 4 days out of 5.
One such Test was this one in 2009: http://www.espncricinfo.com/series/13604/scorecard/401071/west-indies-vs-bangladesh-1st-test-bangladesh-tour-of-west-indies-2009
The appointed captain Mashrafe Mortaza missed over half the match due to injury, and Shakib al Hasan substituted for him. Admittedly this was a third XI of the West Indies, but this was still a landmark for Bangladesh as it was only their second Test win (and the first away from home). Shakib was the appointed captain for the second Test, which led to Bangladesh gaining their third Test victory as well as their first series win abroad.
Mortaza never captained Bangladesh in a Test again, and thus the tables show him with one Test as captain and a 100% success rate. Similar examples include Shastri and Rahane, though Rahane may again captain India soon if Kohli is absent for the proposed Test against Afghanistan. And one cannot help wondering if India’s Test performance in the late 80s and early 90s would have been better if Shastri had been the regular captain rather than his contemporaries Vengsarkar, Srikkanth and Azharuddin.
There have been captains sacked in the middle of a series (Gatting in 1988 for off-field activities, and Denness in 1975 for generally poor results capped by an alleged wrong decision after winning the toss at Birmingham). He was replaced by Greig who seemed to have done a better job in ensuring three draws in the next three Tests against Lillee and Thomson in their prime. Later, when Greig was firmly in place as captain he lost his position in early 1977 following the advent of World Series Cricket.
The 1988 home series against the West Indies saw England with four captains in five Tests (Gatting, Emburey, Emburey, Chris Cowdrey and Gooch). So did India in the 1958-59 home series against the West Indies although that story is more complicated.