He's not the first Doctor to have appeared previously in the show. Colin Baker (Sixth Doctor) previously played Commander Maxil in The Arc of Infinity, a Fifth Doctor (Peter Davison) story.
There have also been companions and other characters over the years who have appeared in various roles. Most recent are Karen Gillan (Amy Pond) who previously played a Soothsayer in The Fires of Pompeii and Freema Agyeman (Martha Jones) who previously played Adeola, a Torchwood employee in Army of Ghosts.