Probably Nils Liedholm at Roma. First stint wasn't particularly eventful, with an average Serie A positioning of 7th and no trophies. Second was spectacular, though — first Serie A title in more than 40 years (ahead of a Juventus team that was managed by Trapattoni and boasted the talents of legends like Platini, Zoff, Scirea, Boniek, Cabrini, Tardelli), reached the European Cup final in 1984 (another first for the club), won 3 Coppa Italia.
Carlo Ancelotti: “I had some important teachers and on a human resources level, none better than Nils Liedholm. In the 1980s he was fundamental, as he didn’t put pressure on.”
Football Italia: Ancelotti, Sacchi & Pep on mentors.
Others, like Nereo Rocco (Milan) and Marcelo Lippi (Juventus) did quite well in their second stints at those clubs, but neither evidenced the same sort of improvement and upward mobility.
As regards players, maybe Jupp Heynckes at Borussia Mönchengladbach? First stint was decent, with 27 Bundesliga goals in total, not bad. Then he joined Hannover 96 and stayed there for 3 seasons. The second stint was extraordinary (as he ushered in a golden period for the club with Weisweiler, Netzer, Vogts, Wimmer and the likes). 232 goals in total (including 195 Bundesliga goals, the most by any player at the time for one club, trailing only Gerd Müller with Bayern Munich), a 3 year stretch where he scored 129 goals in all competitions, European Cup top scorer, twice Bundesliga top scorer, twice UEFA Cup top scorer, Cup Winners' Cup top scorer, 4 Bundesliga titles (as many as Franz Beckenbauer, for reference; those Mönchengladbach teams were a force to be rockoned with on the domestic front), reached the final of the European Cup in 1977.
Again, very few, if any, evidenced the same sort of improvement and upward mobility.