Taking PhD course with potential advisor?
It is certainly worthwhile to get to know your potential advisor, and get noticed back. Taking the course might help you explore common interests, even hint at potential thesis thema.
Taking a more advanced course can get you faster to the bleeding edge where your thesis will presumably move, if it is primarily in the area. Then again, you'll soon have to move beyond coursework. Perhaps somebody teaching the other courses is a better match?
Knowing nothing about your background, the involved courses, your interests and the ones of potential advisors, it is impossible to give real advise.