ARLINGTON, Texas -- On a sleepless Thursday night before Sunday's showdown with the Dallas Cowboys, San Francisco 49ers coach Kyle Shanahan did the only thing that allows him to relax: He watched more football.
Shanahan didn't turn on any ordinary game when he awoke this time. Instead, he flipped on coach's footage of the 1995 NFC Championship Game, which just so happened to be the last time these two historic rivals met in the postseason.
Motivated by what he saw, Shanahan showed the clips to his players on Friday, hoping to ignite some inspiration and help his young team see just how much it meant to play the Cowboys on such a grand stage.
Apparently, it worked.
In a finish befitting the rivalry, the 49ers and Cowboys battled to the bitter end of their nostalgic NFC wild-card meeting. But the Niners -- buoyed by a dominant defense, a strong rushing attack and myriad Cowboys mistakes -- emerged with a 23-17 victory that ensured Shanahan sweet dreams for at least one night.
"I said, 'These guys become everyone's heroes because of what you do in the playoffs, not what you do in the season,'" Shanahan said after his team's harrowing win. "I don't think our guys totally know the rivalry. They've got an idea now. But they knew the moment, and they were ready for it."
In the first playoff meeting in NFL history between two franchises with at least five Super Bowl titles each, the Niners seemed to be in control the whole way.
Even missing defensive end Nick Bosa for the entire second half and linebacker Fred Warner for the final 8:40, San Francisco's defense ruled the day. That group sacked Cowboys quarterback Dak Prescott five times, pressured him on 20 more occasions and limited Dallas' high-scoring offense to 17 points and 307 yards of offense. The Niners' run game also was up to its usual tricks, ripping off 38 carries for 169 yards and two touchdowns.
When the Niners weren't helping themselves, the Cowboys were doing their part to help them out. Prescott's third-quarter interception set up wide receiver Deebo Samuel's 26-yard touchdown run, and the Cowboys racked up 14 penalties for 89 yards, many of which Dallas coach Mike McCarthy apparently did not see the same way.
"I'm not going to sit here and go through the officiating," McCarthy said. "I think over the long haul you hope it balances out. I thought they'd let these teams play today, but that's for them to answer. I'm sure we'll have a call on how they felt the game was officiated."
All of that led to the 49ers jumping out to a 23-7 lead with just under 12 minutes to play. As the Niners have in most games this season, they allowed the Cowboys back in the game with some mistakes of their own, including nine penalties for 58 yards. Quarterback Jimmy Garoppolo also missed wide-open receiver Brandon Aiyuk for a would-be big gain in the third quarter, and the signal-caller's second-half interception set up a Dallas touchdown.
"It was just an emotional game," said Garoppolo, who finished 16-of-25 passing for 172 yards with an interception for a passer rating of 67.4. "The highs and lows of it, everything just never felt like it was getting away from us. I always felt like we were in control of the game."
Indeed, the final sequence was what Niners tight end George Kittle called "wild."
The Niners appeared to have the game sewn up on a Garoppolo sneak with 40 seconds left, but left tackle Trent Williams was flagged for a false start. That gave the Cowboys a chance to drive 80 yards for the potential game-winning score.
Dallas quickly moved into San Francisco territory and had a second-and-1 at San Francisco's 41 with 14 seconds left. Prescott took off on a designed run for a gain of 24 to the Niners' 17. But the Cowboys couldn't get another snap off, and the officials declared the game over.
"Just a little bit of a roller coaster," Kittle said. "A lot of ups and downs, a lot of unknowns. I think the Niners make for great TV."
With the win, the 49ers (+3.5) became the first underdogs and road team to win in this postseason. It's a victory that comes 40 years and a week after "The Catch" in a win versus the Cowboys in the NFC Championship Game following the 1981 season.
The Niners and Cowboys entered Sunday's meeting with a combined 67 playoff wins, tied for the most entering a playoff matchup all time. Dallas had won its previous three wild-card games, all at home, before Sunday's defeat.
Traditionally, the winner of a 49ers-Cowboys playoff game has continued on to postseason success. The victor of five of the previous seven postseason meetings, including each of the past four, has gone on to win the Super Bowl.
The Niners' victory also moved them to 3-5 all time against Dallas in the playoffs, and it sets up an NFC divisional-round matchup against another historic rival, the Green Bay Packers, on Saturday night at Lambeau Field.
It all undoubtedly meant a lot to Shanahan, whose father, Mike, was the Niners' offensive coordinator for some of the famous meetings between these teams in the 1990s.
But Shanahan's message, spurred by a sleepless Thursday night, clearly resonated in the locker room, as well.
"We stand on the shoulders of legends," Kittle said. "We really do. And one thing I learned in college is you always want to leave your jersey in a better place; and there's so many 49ers who left the jersey in a better place, and that's what we're trying to do too. Just trying to play at a high level and win games that matter."