GLENDALE, Ariz. -- Jim Harbaugh was almost giddy after the 49ers beat the Cardinals 23-20 on a 40-yard field goal as time expired Sunday in University of Phoenix Stadium. He kept smiling and chuckling in the locker room, breaking the routine only to slip a wad of chewing tobacco beneath his lower lip. Then he started smiling and chuckling again.
All wins are good, but some are more satisfying than others because of how they were achieved. Sunday was one of those occasions. Matched against a division rival who was coming off a memorable road win and looking to set a franchise record for victories in a season, the 49ers were on the ropes after squandering a 17-0 first-quarter lead. Even after they went back up 20-17 late in the fourth quarter, Arizona responded by going 55 yards in eight plays to tie the score with 34 seconds to play.
The sellout crowd roared. Perhaps more than any other team in the NFC West, the Cardinals can't stand the 49ers. Part of their feeling is rooted in respect for what San Francisco has accomplished, advancing to the Super Bowl last season and the NFC title game the year before that.
MORE COVERAGE: Week 17 Snaps | Previewing wild-card weekend | Top-10 Mock Draft
Such moments can spook a team with less resolve, but there was calm on the San Francisco sideline. After LaMichael James returned the ensuing kickoff 45 yards, Colin Kaepernick found Anquan Boldin for 18 yards and Quinton Patton, a fourth-round rookie who had only one catch for no yards coming into the game, for 29 more to set up Phil Dawson for the decisive points and advance the 49ers into a Jan. 5 wild-card game against the Packers in Green Bay.
"I love our team. I love our fight," said Harbaugh, who is 3-0 against the Packers (including postseason). "They compete always. They play this game like they really want to win every time they play, and it's very important to them that they not let anything slip."
If there's reason to believe the 49ers can take the next step and complete a journey that left them 5 yards shy of the goal line and a win in Super Bowl XLVII, it could be that these players feel hardened by not only that memory, but also the adversity they've overcome this season. It began with an offseason Achilles injury that sidelined wideout Michael Crabtree for most of the regular season and continued with the season-ending loss of nickel cornerback Chris Culliver to a torn ACL in training camp. There also were struggles with the offense in general and Kaepernick in particular, as his passing stats declined significantly with his favorite target, Crabtree, sidelined.
Along the way they lost back-to-back games for the first time since Harbaugh was hired in 2011 -- not once, but twice. The first time was by 26 to the Seahawks and by 20 to the Colts; the second was by one to Carolina and by three to New Orleans. Such struggles after two years of relative dominance can play tricks on a team's psyche, or it can be the fire that hardens its resolve.
"We understand that each game can come down to a fight, and we're willing to go the distance," said linebacker Patrick Willis. "If you can fight through those tough times, you can fight through those moments that call for everything you've got. That's us now."
Sunday was the second time in four weeks and the third time in the last seven that San Francisco was involved in a game decided by a field goal in the final 26 seconds. Overall it was the fifth time the Niners have had an outcome decided by six points or less; they're 3-2 in those games, but have won the last two.
"Those situations build that fight in you," said linebacker NaVorro Bowman, a Defensive Player of the Year candidate. "We faced more tougher situations this year, and it's made us a better team of just not folding. If you asked people who's a team that doesn't fold when things don't look good, they'd probably say us. We don't let too much get to us or get us out of our game."
The road to the title won't start in San Francisco, as it did the previous two postseasons when the Niners hosted divisional games after first-round byes. They will hit the road this time, their first stop being Green Bay.
"The thing about them is that it doesn't matter where they go," said Cardinals wide receiver Larry Fitzgerald. "Their game travels. Indoor, outdoor, wet, dry _ doesn't matter. They play great defense and they can grind you out with their running game, with Frank Gore. They're a hard-nosed, smash mouth team."
The 49ers aren't playing with the same efficiency as a year ago, but they're coming up with big plays when they need them. Like Patton's catch Sunday, and Bowman's 89-yard interception return for a score in the final two minutes when Atlanta was driving for the winning score, and Gore's 51-yard run late in the fourth quarter to set up a field goal in a 19-17 win over Seattle. It's those types of plays, those types of moments, that make some teams believe when others would start to doubt.
"I won't say it had been easy for us, but in the past we didn't have to go through as many things as we've gone through this year to get to this point," said cornerback Carlos Rogers. "It's only going to help us."
The other thing that could aid them is the memory of last season's Super Bowl.
"We know what it's like to lose in the Super Bowl," said tight end Vernon Davis. "It's a horrible feeling. Don't really want to have to go through it again. Our ultimate goal is to get back and win it. Guys are really cognizant of that and they're going into it with more poise. We're relaxed. Last year I think we were a little anxious in the beginning. This year we know what to expect. We're ready."