The gemara today is the foundation of one of the most fundamental practical leniencies in the rules of yayin nesech. Rav made a statement that a young child who doesn't have "intent" to come into contact with the wine, still renders the wine to be yayin nesech. However, from the story of the goy who touches the wine with his lulav, the gemara proves that Rav never extended the prohibition to an issur of benefit, only an issur to drink. Shmuel made a statement that a slave even after going through a full conversion (mila and tevila), his contact with wine would still render it yayin nesech until the avoda zara is out of his system, which the gemara considers to take 12 months (we find in the context of yi'ush on a lost object and in the gemara at the end of brachos in the context of forgetting the deceased, that 12 months is the time it takes to forget - although in the context of yefas to'ar the ramban explains that some level of forgetting is achieved after just 30 days). The gemara proves from a braisa that both Rav and Shmuel cannot be correct - if we pasken like Shmuel we reject Rav. Tosafos quotes Rabbeinu Tam who paskens like Shmuel (and paskens like the lashon of the saliva and midras being tahor) which compels us to say that the braisa rejects Rav. Since even Rav only considered the wine that a goyish child touches to be assur to drink, the braisa which rejects the stringency of Rav would hold that it is mutar to even drink. Therefore, Rabbeinu Tam should hold that if a child even up to the age of 10 or 11 (which is presumably the age given by the braisa where he understands the worship of idolatry) who touches wine, would not in anyway make the wine assur - it would even be permitted to drink.
Tosafos quotes the Rivan (rashi's son in law) and the Rashbam (rashi's grandson - the son of his other son in law, rabbeinu meir, and older brother of rabbeinu tam) in the name of Rashi that all goyim nowadays who are somewhat removed from idolatry have the status of a child. The rationale for this ruling would be that the fundamental issur on wine to drink is because of intermarriage (36b), just that it was extended to any benefit because of idolatry (Tosafos 29b), therefore in the absence of idolatry the only prohibition applicable is the issur to drink (similar to bishul akum and pas akum). The R"i sent a letter to Rabbeinu Tam saying that combining the p'sak of Rabbeinu Tam with that of Rashi would make obsolete the entire prohibition of stam yeiynam (r"t who rejects rav would permit contact of a child to even drink, and rashi would qualify all goyim as "children"). Rabbeinu Tam responded that he never paskened against Rav's statement that wine which came into contact of a child is forbidden to drink (he claimed to have misquoted by a student). R"T adds that we actually reject the statement of Shmuel, which compels us to pasken like Rav forbidding the wine to drink. But, Rabbeinu Tam confirms the p'sak of Rashi that all goyim are considered like "children". However, the R"i challenges even the p'sak of Rashi because a child who doesn't even intend to touch is not the same as an adult who intends to touch the wine just not so tied to avoda zara. Rabbeinu Tam confirms that there is no obvious proof to Rashi and concludes that any wine touched by a goy should be forbidden to benefit from BUT - ואף על פי כן, לא רצה רבינו תם לאסור הואיל ושפט המנהג להתיר, והנח לישראל שיהו שוגגים ואל יהו מזידין
In conclusion, we don't have any proof to Rashi, but we also don't reject his ruling. Therefore, the very first Rama in Hilchos yayin nesech (123:1) quotes the opinion of Rashi equating all goyim nowadays with the child spoken about by the gemara, and permits benefit from the wine that he touched. But, the Rama rules that one can only rely on this to prevent a loss, but l'chatchila it is forbidden to purchase wine touched by a goy in order to sell. The Gr"a (5) confirms this ruling, since many ge'onim forbid it, it is sufficient to be matir only when there is a pressing need.