“You learn to win,” David Freese said of the Cardinals’ developmental philosophy. (Dilip Vishwanat/GETTY IMAGES)

In the hours before Game 5 of the National League Championship Series, David Freese — who spent last October fighting off the potential final strike of the St. Louis Cardinals’ season, and this October doing it once more — considered the qualities that make his franchise successful. The Cardinals are in the postseason for the ninth time in 13 years. They are seeking their fourth pennant in that time. Despite a shutout loss to the San Francisco Giants on Friday night, they still hold a three-games-to-two lead in the series.

“You learn to win,” Freese said of the Cardinals’ developmental philosophy.

Hours later, in the visiting clubhouse at Busch Stadium, music pumped through the speakers. Marco Scutaro, the Giants’ second baseman, sat in front of his locker, hunched over, and considered the qualities of the players around him.

“We’re a team that will never give up,” Scutaro said. “We were fighting. We’ve been in this situation before.”

While the Detroit Tigers steamrolled the New York Yankees and will spend the weekend waiting for the World Series to start, the NLCS trudges forward to Sunday’s Game 6 because it features the National League’s two most resilient teams. By Monday night, either the Cardinals or the Giants will be eliminated. But at this point, each is a cockroach that can’t be crushed, even when cornered by the biggest boot.

The Cardinals, who send postseason maestro Chris Carpenter to the mound Sunday, might well earn a second straight pennant, and if they do, much credit will be given to the way they develop players — not just their baseball skills, but their focus on winning. The Giants, who counter with Ryan Vogelsong and — if they win Sunday — ace Matt Cain in Game 7, could well come back, and if they do, they will be credited with an uncommon will. They already faced a 2-0 deficit against the Cincinnati Reds in the division series and had to stave off the Cardinals in Busch Stadium in Game 5, and a second pennant in three years would mean a 6-0 record in games in which they faced elimination.

“I think it’s perseverance through the whole season is where we draw the confidence that it’s not over until the last out is made,” Vogelsong said late Friday night.

Start, then, with the Giants, because they could be eliminated Sunday, they could have been eliminated Friday, they could have been eliminated last week. They won the NL West and hosted the Reds in the first two games of their division series. They were outscored 14-2 in those two games, and headed to Cincinnati for what seemed like a formality: the end of their season.

There, Vogelsong allowed one run in five innings of Game 3. They capitalized on a two-out error by Reds third baseman Scott Rolen in the 10th. They got five more scoreless innings from their bullpen. They survived with a 2-1 victory, then never trailed again in the series.

“When you can’t lose,” Vogelsong said, “I think we definitely do play a little bit harder.”

This, though, isn’t just about the postseason, Vogelsong said. In the clubhouse Friday night was Brian Wilson, the Giants’ goofball closer who had ligament replacement surgery on his elbow in April and appeared in just two games this season. Absent from the Giants, but still part of their success, was outfielder Melky Cabrera, who hit .346 and was an all-star for San Francisco before he was banned for 50 games after testing positive for testosterone.

So playoff deficits are the culmination of the things the Giants have overcome.

“Everyone counted us out four or five times this year already,” Vogelsong said. “First when Wilson went down, people said we couldn’t do it. Then we lost Melky, unfortunately. People said we couldn’t do it.

“The Dodgers made the big trade,” Vogelsong continued, pointing to the deal with Boston that brought right-hander Josh Beckett and first baseman Adrian Gonzalez to Los Angeles. “People said we weren’t going to do it. We go down two to Cincinnati, they said we’re not going to do it.”

Now, who’s to say?

The Giants’ chief problem, as they pen this we’re-best-when-we’re-down tale, is that the Cardinals stand on the other side. The particulars of their Game 5 comeback against the Washington Nationals have been dissected for a week now, and in Washington will be dissected till spring and beyond. But in St. Louis, there was a sense that once the Nationals started squeezing their 6-0 lead, the Cardinals were the kind of team that could pounce. They did it in facing a three-games-to-two deficit in the 2011 World Series against Texas.

“Last year was great,” Freese said. “But you want more.”

The Cardinals can also tick off a list of bumps they endured during the season, most notably the elbow injury that took out shortstop Rafael Furcal, the leadoff hitter on opening day, in late August. In St. Louis, the culture allows that the man who filled in for him, Pete Kozma — who never hit higher than .258 at any minor league level — would come up, hit .333 over the rest of the regular season, and win Game 5 of the division series with a two-run single.

“That’s just kind of how it is around here,” second baseman Daniel Descalso said. “If someone goes down, the next guy is supposed to go in there and do the job. We have every confidence that he will.”

In this series, both teams feel that way. The Tigers await. They will face a group of true survivors, regardless of who wins.