Yep, it sure does. As the old quote goes, the influence of a teacher ends at eternity. So what exactly is the impact? This paper investigated the impact of teacher quality on 1000 students in one Italian university. Guess what they found?
the researchers found that there is a statistically significant impact on student performance in subsequent courses. In other words, if you have a good teacher in the first year, then your performance in the later years would be much better than students who had crap teachers in the first year.
Another interesting result they found was that doing research doesnt really make that much of an impact on the students, and worse, if you are a teacher who does too much research, then the performance of a student actually gets impacted negatively.
Pretty sad, no? Our universities are rather mucked up, we drive our best teachers into the damn research organisations where they are worse for the students. And all the best teachers rarely teach the first years.