We consider all matches played by professional tennis players between 1968 and 2010, and, on the basis of this data set, construct a directed and weighted network of contacts. The resulting graph shows complex features, typical of many real networked systems studied in literature. We develop a diffusion algorithm and apply it to the tennis contact network in order to rank professional players. Jimmy Connors is identified as the best player of the history of tennis according to our ranking procedure. We perform a complete analysis by determining the best players on specific playing surfaces as well as the best ones in each of the years covered by the data set. The results of our technique are compared to those of two other well established methods. In general, we observe that our ranking method performs better: it has a higher predictive power and does not require the arbitrary introduction of external criteria for the correct assessment of the quality of players. The present work provides a novel evidence of the utility of tools and methods of network theory in real applications.