Is there a correlation between being a good teacher and being a good researcher?
It seems likely that there's some nonzero correlation.  Certainly, there are factors that should lead to positive correlation; for example, some personality traits (like conscientiousness) should lead to both better research and better teaching.  There are also factors that should lead to negative correlation; for example, teaching and research are activities that are competing for a limited amount of time.  It would be strange if all these factors nearly cancelled each other out, so we should expect some net correlation.  Here's an argument for positive:

Let's distinguish between two aspects of teaching, namely exposition and psychology.  Exposition means finding simple explanations, coming up with illuminating examples and analogies, mapping out the most important topics and the relationships between them, etc.  Psychology means understanding where students are coming from and what they do or don't understand, empathizing and bonding with them, arousing their interest and inspiring them to achieve great things, etc.  Both of these are important factors in good teaching, although neither is absolutely essential.  A master of exposition without a good understanding of psychology may be clear but dull, and someone who understands psychology but isn't good at exposition may have to follow a textbook closely, but either one will be much better than some teachers.

Expository ability is almost certainly correlated with research ability, since they both rely on a deep, creative understanding of the subject matter.  In mathematics, the standard example is Jean-Pierre Serre, who is both a brilliant mathematician and the author of several amazing graduate textbooks, and one can see similar characteristics in his research papers and textbooks.

However, the psychology side of teaching is probably not closely connected with research ability.  There may be some correlation, just because smart people tend to be better than average at all kinds of thinking, but I'd bet the correlation is small.  Certainly, there are wonderful researchers who have a terrible understanding of psychology, and vice versa, in a far more dramatic way than for exposition.

I see this split as perhaps explaining why there's so much debate about whether good research and good teaching are correlated, with some people saying obviously yes and others obviously no.  The answer depends on which aspects of teaching you view as most important.