NEW ORLEANS (AP) - Ahmad Brooks burst into the backfield and leveled Drew Brees, forcing a lost fumble that he thought would seal a San Francisco victory.
Then he noticed the dreaded yellow flag landing near the spot of his big hit.
He knew the call was on him. Soon after, the defending NFC champion 49ers let a second straight game slip away.
The New Orleans Saints capitalized on Brooks' penalty with a tying 42-yard field goal by Garrett Hartley, then won 23-20 on a 31-yard Hartley kick as time expired on Sunday.
Brooks was flagged for hitting Brees in the head and neck on a violent sack that left Brees with blood on his chin. There was 3:12 left and the 49ers led 20-17.
"I was like, OK, here we go again," Brooks said of his animated reaction to the penalty. "It was very frustrating. The game could have gone a totally different direction that what it went. I was just mad because that was a big play in the game. We lost, and that's probably the reason why."
That wasn't the only play the 49ers regretted after allowing to the Saints to kick field goals on their last three possessions. Following Hartley's 21-yard field goal that cut New Orleans' deficit to 20-17 with 7:50 left, wide-open San Francisco running back Frank Gore dropped a pass from Colin Kaepernick with a blocker in front of him and only one Saints defender on his side of the field.
Gore was thinking 79-yard touchdown. His miscue turned it into a third down, and the 49ers punted.
"I have to make that play," Gore said. "I'm a better player than that. If I had made that play, we would have won the game."
A week after losing 10-9 to Carolina, San Francisco struggled again on offense, finishing with 196 yards. Gore picked up 48 yards on 13 carries. Kaepernick went 17 of 31 and passed for two touchdowns but also was sacked three times and threw for only 127 yards. He scrambled three times for 25 yards.
His last run was a 16-yarder that came up just 3 yards short of a first down on third-and-long with less than two minutes to go.
That gave Brees all the time he needed to lead a game-winning drive in regulation.
"You're going to have games like this," Brees said. "You still find way to win against a playoff-caliber opponent with a lot at stake at this point in the season. That says a lot."
No Super Bowl loser has returned to the Super Bowl the following year since Buffalo in 1993, and the 49ers (6-4) have put themselves in a tough position, falling three-and-a-half games behind division rival Seattle.
"The greater the challenge, the greater the glory," coach Jim Harbaugh said. "That's the way I look at it. I'm proud of our guys for the way they fight, and if we continue to do that, we're going to win a lot of games."
Kaepernick's best play might have come right after his worst, an interception that had cornerback Corey White heading for the end zone. Kaepernick chased him down inside the 5, and as White tried to dive into the end zone, the ball flew out for a touchback.
"I just tried to do whatever I could do to stop him from scoring," Kaepernick said. "I don't know if I knocked it out, but I made him make an effort that he wouldn't have had to do otherwise."
The 49ers then drove for a 55-yard field goal by Phil Dawson, taking a 10-7 lead.
New Orleans regained the lead at 14-10, thanks to Travaris Cadet's 82-yard kickoff return, which set up Jed Collins' 1-yard touchdown run.
But in the third quarter, Brees, scrambling right, tried to lob a pass to Graham, only to have Brooks leap up and tip the ball to himself for an interception he returned to the Saints 22.
Soon after, Vernon Davis' 17-yard TD catch made it 17-14.
The 49ers could not hold on, although they kept pointing to Brooks' roughing-the-passer penalty as a tough break rather than a self-inflicted mistake.
"I was going full speed, he was going full speed," Brooks said. "Maybe could have tackled him lower, but I'm rushing around the edge, turning the corner and trying to knock the ball out of his hands."
NOTES: Kaepernick has thrown for 150 yards or fewer in all four of the 49ers' losses. .. Harbaugh had no concrete update on the status of injured guard Mike Iupati, who exited with a left knee injury in the third quarter, or cornerback Tarell Brown, who left with a rib contusion in the second quarter. . Marques Colston finished with five catches for 80 yards to become the Saints' all-time leader in yards receiving with 7,923, passing Eric Martin's two-decade-old mark of 7,854.
AP NFL website: www.pro32.ap.org
(Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)