PITTSBURGH (AP) -- Pinch-runner Josh Harrison stood on second base in the bottom of the eighth inning and pointed to Pittsburgh Pirates third base coach Nick Leyva.
''I told him to get that arm ready, because I'm coming,'' Harrison said.
Moments later, Harrison was streaking across home plate to give the Pirates the lead. Minutes after that, the Jolly Roger that's been a fixture on the Pittsburgh skyline all summer climbed up the flagpole again.
Harrison scored on Pedro Alvarez's tiebreaking single Sunday, sending the Pirates to a 5-3 victory over the St. Louis Cardinals that staked Pittsburgh to a 2-1 lead in the best-of-five NL division series.
Russell Martin followed with a sharp RBI single against reliever Kevin Siegrist, who took over after Carlos Martinez (0-1) faltered.
The go-ahead single was the latest big hit by Alvarez. He homered in the first two games against St. Louis and is 4 for 10 with four RBIs in the series.
Alvarez also kept the Pirates' famous flag flying high in October. ''Raise the Jolly Roger!'' is the rallying cry for this wild-card team, now one victory from its first postseason series win since Willie Stargell, Dave Parker and the ''We Are Family'' gang won it all in 1979.
''We're continuing to surprise a lot of people, I believe. We're continuing to show people that we're not done, that we're not just happy to be in the postseason,'' star center fielder Andrew McCutchen said. ''We're fighting to win a World Series.''
Heady territory for a franchise that had endured a record 20 consecutive years of losing coming into this season. Six months later, the Pirates are on the cusp of knocking out baseball royalty.
Mark Melancon (1-0) picked up the win despite allowing Carlos Beltran's tying home run in the top of the eighth. Jason Grilli worked the ninth for a save.
Charlie Morton is set to start for Pittsburgh in Game 4 on Monday against rookie Michael Wacha.
Beltran finished 2 for 3 with three RBIs. His 16th playoff home run moved him past Babe Ruth for eighth place in postseason history.
''It's a must-win tomorrow for us,'' Beltran said. ''Hopefully we can come here tomorrow, take care of business, win and go play the last game at home.''
Beltran's shot temporarily silenced a rocking crowd at PNC Park. It also set the stage for another dramatic win by the Pirates.
McCutchen led off the eighth with his second hit, a double to left. But the NL MVP candidate unwisely tried to advance on Justin Morneau's grounder to shortstop and was an easy out at third.
Harrison ran for Morneau and moved up when Marlon Byrd walked. St. Louis manager Mike Matheny turned to a lefty in Siegrist to face the left-handed Alvarez. The Pittsburgh slugger tied for the NL lead with 36 homers during the regular season, but hit just .180 against lefties.
''I just knew it was going to be a tough matchup,'' Alvarez said. ''I've seen him a couple of times before. I haven't had much success. He's a pitcher with good stuff - great stuff. He threw me a couple of fastballs out over the plate.''
One too many, as it turned out, and Alvarez singled between first and second. Martin then fouled off a squeeze bunt before lining a hit to left that gave Grilli more than enough cushion.
The game was a rare nail-biter between two clubs that spent the summer shadowing each other in the race for the NL Central title. Coming into Sunday, only five of the previous 21 matchups between the two were decided by two runs or less.
After blowouts by each club in St. Louis, there wasn't much room to breathe in front of a frenzied, black-clad crowd looking for a repeat of Pittsburgh's giddy 6-2 romp over Cincinnati in the wild-card game last Tuesday.
Martin's sacrifice fly off reliever Seth Maness in the sixth gave the Pirates a 3-2 lead and turned the game over to Pittsburgh's ''Shark Tank'' bullpen, one of the keys to the franchise's first winning season and playoff berth in a generation.
Tony Watson worked around a one-out single in the seventh before giving way to Melancon.
The Cardinals must win two straight to advance to the NL championship series for the third straight year.
''We've been in this situation,'' Beltran said. ''Last year, I think we were in this situation a lot. So I think we're fine, man. We want to come here tomorrow, we want to win and hopefully take this series home.''
Pirates starter Francisco Liriano dominated the Cardinals during the regular season, going 3-0 with an 0.75 ERA in three starts against the NL's highest-scoring team. He was electric against the Reds last Tuesday, shaking off a sinus infection and baffling them with a series of changeups and sliders that ended Cincinnati's season and manager Dusty Baker's tenure.
Liriano narrowly escaped damage in the third Sunday when Matt Holliday lined to right with the bases loaded.
The left-hander wasn't quite as fortunate in the fifth. Jon Jay led off with a single and Pete Kozma followed with a walk. After pitcher Joe Kelly struck out trying to bunt, a double steal set up Beltran's two-run single.
At 2-all, the Cardinals had matched their entire output against Liriano in their previous 28 innings.
Liriano was matched nearly pitch for pitch by the unflappable Kelly. The 25-year-old right-hander has been rock-steady all season, even as he moved from middle reliever to starter in July.
Kelly welcomed the hostile environment, calling the sea of black-clad fans that awaited him one of the things a kid dreams about.
The reality proved a little more unnerving, at least when Byrd hit a two-run single in the first.
The well-traveled outfielder - who played in 1,250 regular-season games before reaching the playoffs for the first time - has been a welcome jolt both in the lineup and in the clubhouse for the Pirates.
''Just having a heck of a time,'' Byrd said.
NOTES: Grilli worked around a leadoff single in the ninth. ... McCutchen is batting .538 (7 for 13) and has an on-base percentage of .684 in the playoffs. His five walks rank first in the league this postseason. ... Beltran's home run was the first by the Cardinals in 10 games at PNC Park this year.
Follow Will Graves at www.twitter.com/WillGravesAP