Cardinals ace Wainwright had struggled in his previous two starts but was back to his brilliant best at Busch Stadium, giving up just two hits.
David Freese led the Cards' offense with a two-run homer in the sixth inning.
St Louis are now a half game ahead of the Pirates with Cincinnati a further game back following the Reds' 4-3 defeat of NL West leaders the Los Angeles Dodgers.
Speedster Billy Hamilton scored the winning run, racing home from second base on Todd Frazier's single in the 10th inning.
Atlanta continue to boss the NL East despite a 6-5 defeat to Philadelphia - the Braves' third successive loss.
Andrelton Simmons tied the game at 5-5 in the top of the ninth off Phillies closer Jonathan Papelbon but the hosts came again and won it in the bottom half through Freddy Galvis' walk-off solo homer.
San Diego beat Colorado 2-1, Washington beat Miami 9-2, the Chicago Cubs lost 5-3 to Milwaukee and Arizona saw off San Francisco 2-1.
In-form Mike Napoli hit two home runs as free-scoring Boston won their fifth successive game - and third in a row against the New York Yankees in the Bronx - 13-9.
Jonny Gomes crushed a three-run shot and Xander Bogaerts belted his first big league home run as the Sox held off a late charge from the Yankees to maintain their grip on top spot in the American League East.
AL Central Leaders Detroit lost 4-3 to Kansas City, for whom Salvador Perez hit the go-ahead two-run home run in the sixth inning.
Dan Straily pitched seven scoreless innings as Oakland remained top of the AL West with a 2-1 win against Houston.
Yoenis Cespedes and Jed Lowrie homered as the As won for the seventh time in nine games to remain a game ahead of Texas, who lost 8-3 to the Los Angeles Angels.
Adam Lind hit a pair of three-run homers as Toronto beat Minnesota 11-2, Baltimore edged out the Chicago White Sox 4-3 and Seattle overcame Tampa Bay 6-2.
In interleague play, Cleveland powered past the New York Mets 9-4.