Kaepernick completed a 51-yard pass on fourth down to sustain a tying drive in the final minutes of regulation, Brooks sacked and stripped Drew Brees in overtime, and Phil Dawson kicked a 35-yard field goal to cap San Francisco's stirring 27-24 victory over New Orleans on Sunday.
The victory snapped a two-game skid for the Niners (5-4) and marked the first home loss for the Saints (4-5) in more than a season.
''It was paramount for us to come out with a win,'' San Francisco left tackle Joe Staley said. ''You don't like to say must-win, but it was a must-win game. We looked at that game as a playoff game, and we had that mindset coming in.''
New Orleans had won 11 straight in the Superdome - 20 straight at home in games coached by Sean Payton, who was suspended in 2012. It looked like that streak would continue after New Orleans erased an 11-point halftime deficit and took a lead on Brees' 2-yard scoring pass to Jimmy Graham with 1:52 left.
Even after the Niners tied it on Dawson's 45-yard field goal with 44 seconds left, the Saints nearly won on the final play of regulation. Brees heaved a long toss that Graham, who played college basketball, leaped up and caught in the end zone - but the star tight end was called for pass interference after appearing to shove defensive back Perrish Cox to the turf.
''Definitely not a push off. I'm running down the field and I'm telling myself not to push off. Whatever you do, don't push off. Just go up and get it,'' Graham said. ''It's interesting, you know, how guys grab me everywhere on the field and I put literally two fingers on somebody and you make that kind of call. That's why I switched. That's why I left basketball, so I could stop being penalized for hitting people.''
Brooks' decisive blow on his sack of Brees had to feel like poetic justice to the Niners' defensive stalwart. His unsportsmanlike conduct penalty on a vicious sack and strip in the Superdome a year ago allowed the Saints to pull out a late comeback victory.
This time, Brooks' play set up Dawson's winning kick with 5:14 remaining in overtime.
''God smiled down on me today,'' Brooks said. ''I was rushing and turning the corner thinking, `Dang, is he going to throw the ball yet?' But he didn't, and I was able to make the play.''
Brees wanted to throw over the middle to Travaris Cadet, but the running back had tripped, so Brees waited and re-cocked his arm as Cadet got up.
''It's a game of inches and split seconds, and they got it out just before my arm was coming forward,'' Brees said.
New Orleans' defense, which sacked Kaepernick four times, dominated nearly the entire second half, allowing the Saints to come back. All New Orleans needed was a stop on fourth-and-10 to close the deal.
Kaepernick rolled right to buy time, spotted Michael Crabtree deep down field and unloaded his game-saving pass to the Saints' 27.
Crabtree ''was about the third or fourth guy I looked at when I was scrambling,'' Kaepernick said. ''I wasn't expecting it, but I'm happy it happened that way.''
Brees was intercepted twice, the second time by Chris Culliver late in the first half on a pass intended for Graham, who was at the Niners' goal line but had three defenders around him. The squandered scoring chance drew boos.
''I can't turn the ball over at the rate that I'm turning it over and I certainly can't turn it over in the situations that I'm turning it over,'' said Brees, who's thrown 10 interceptions. ''I would have booed myself on that one.''
Brees also passed for three scores, and began the Saints' second-half comeback spectacularly, spinning away from blitzers Michael Wilhoite and Eric Reid before finding Graham for an 11-yard TD. Brees later marched New Orleans 80 yards in 12 plays, hitting Marques Colston for a fourth-down conversion before punishing a Niners blitz with a quick 2-yard TD pass to Graham.
Brees finished 28 of 47 for 292 yards, including 10 connections with Graham for 76 yards and a 31-yard TD to rookie Brandin Cooks.
NOTES: San Francisco nose tackle Ian Williams left the game with an injured leg and receiver Bruce Ellington left with an ankle injury. ... Saints cornerback Keenan Lewis was carted off in the first half, then returned in the third quarter, after the Saints had said he would not return. ... Saints safety Vinnie Sunseri left with an arm injury and running back Edwin Baker left with a concussion that occurred on a special teams play.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL