Lynn (11-8) awkwardly came off the mound to field Juan Perez’s leadoff chopper in the eighth and twisted his right ankle trying to throw to first. That was Lynn’s final batter, and he exited with a mild ankle sprain that will be reevaluated Sunday.
Lynn gave up six hits, struck out two and walked two. He had been 0-4 with a 6.33 ERA in his previous four regular-season starts against San Francisco and 0-1 in three postseason outings.
The right-hander outpitched Ryan Vogelsong (9-10) after losing to him 2-0 on Aug. 18 at Busch Stadium.
The NL Central-leading Cardinals broke open a scoreless game with four runs in the fifth. Matt Carpenter hit an RBI single for the lead and Yadier Molina capped it with a two-run single.