SAN FRANCISCO -- The 49ers had come from behind, Candlestick Park was rocking, the kickoff team was dancing and the defense, that wicked unit at the heart of this team, was snorting and grunting.
The smell of victory was in the air. It was time to put St. Louis back in its place and remind everyone who owns the NFC West.
Yet with a defense eager to redeem itself after being pushed around in the first quarter, when it allowed two touchdowns, the 49ers could not close it out.
Yes, the defense, the bedrock of their championship aspirations, failed them in a moment of need.
Of the many wild and weird occurrences Sunday at the 'Stick, of all the regrets and laments that come with this 24-24 tie with the Rams, nothing should be more alarming than the sight of a 49ers defense unable to stop a Rams offense with the game at stake.
The Rams, still living with bulldog running back Steven Jackson while building an offense around young quarterback Sam Bradford, gained new life after converting a fake punt and used that opportunity to score a go-ahead touchdown with 1:09 remaining in regulation.
The Niners "D" took the field with a 21-17 lead, with St. Louis taking over at its own 19-yard line and 8:16 to play. The object was clear: The 49ers likely win if they keep the Rams out of the end zone.
"We had an opportunity there, and we didn't seize it," safety Dashon Goldson said.
St. Louis marched 81 yards, 62 of which came against the San Francisco defense, punctuated by a 2-yard touchdown pass from Bradford -- who completed seven of the eight passes he threw on the drive -- to wide receiver Austin Pettis.
San Francisco's patented defense looked, well, helpless. Its pass rush was a split-second late, its secondary a step behind. Shifty slot receiver Danny Amendola, who consistently found open spaces, snagged four of his 11 catches on the drive.
"He's going to get his yards," safety Donte Whitner said of Amendola. "But we just have to finish that football game and come out with a win."
The entire sequence was disconcerting for a 49ers defense ranked No. 1 in the NFC and No. 2 in the NFL. If there is one signature characteristic of a quality defense, a winning defense, it is the ability to hold a lead in the fourth quarter -- a knack for responding to the smell of victory.
"Finish. Finish. It's all about finishing," cornerback Tarell Brown said. "We feel we want to put it on our shoulders. And we did. But we definitely have to finish a lot better as a defense."
This is such a telling statement -- the kind of statement generally uttered by members of a unit in search of its game, a team learning how to win.
Yet it's an entirely accurate assessment of the defensive unit that last season led the 49ers to the NFC Championship game.
As terrific as this unit is, it can be shockingly vulnerable. The Rams worked the San Francisco defense for 458 yards, with Jackson (101) and backup Daryl Richardson (58) combining for 159 on 36 rushes.
The fourth quarter, however, can be the biggest enemy of the Niners defense. It has allowed more points in the fourth than any other quarter.
This can't be a comfortable acknowledgment for a team moving into the defining portion of its schedule -- the Chicago Bears are next, followed by a trip to New Orleans and jaunt to St. Louis.
"We know what we have to do," Brown said. "We know what we're capable of. We just have to do it every down and consistently."
It wouldn't be fair to pin this loss entirely on the defense. The Rams twice executed fake punts, the second of which came on the drive that momentarily put the Rams ahead. The 49ers didn't get much going on offense behind second-year quarterback Colin Kaepernick, who replaced Alex Smith (concussion) in the second quarter.
Yet the defense was given several second chances and still couldn't find the route to victory.
"We played well," Goldson said. "We just left too much out there. We have to get off the field on third down."
The 49ers and their fully formed defensive unit go into a new week having to accept that victory was stolen by a Rams offense still developing its identity.
That the game was not lost is, as it should be, of little consolation.
"We're about wins around here," Whitner said. "So we're not going to take any satisfaction in this football game."
That's why, at the end, the stadium was quiet and no one was dancing. The mightiest and most reliable component of this team failed to protect it from disappointment. It was a sobering moment.