I feel like the recommendation of someone who knows you well would be better. One of my recommendations was from a TA, whom I chose over the professor because I worked more directly with him and he knew me better. I don't think rank is as important as painting a complete picture of the applicant. But I can't say for sure.