Brooks seemed assured of his first victory in seven starts on the Champions Tour when he led by three strokes with four to play. But he hit into the water on 17 and needed a nifty putt just to make bogey. He then three-putted on 18 to hand the title to Gilder, who also won this tournament in 2002.
The 60-year-old Gilder earned his 10th victory on the Champions Tour but first since 2006. He closed with a 6-under 65 for a 14-under 199 total.
"It's just been a long time," said Gilder, choking up in the emotion of the moment. "You put in a lot of work as you get older. You kind of wonder if you can do it again."
Brooks, the leader after the first two rounds, shot 68. Mike Goodes and Rod Spittle each came in at 65 to finish two strokes back. Mark Calcavecchia, who trailed Brooks by one stroke heading into Sunday, shot 69 and finished three off the lead.
"That was a disaster," Brooks said.
Gilder's victory followed 61-year-old Tom Watson's win in the Senior PGA Championship, the first time in the 50-and-over tour's history that 60-plus golfers have won back-to-back tournaments. It's just the 20th time that a player 60 or over has won.
Gilder also snapped a streak of four straight tournaments ending in playoffs. But even with Gilder's clinching putt, this one appeared headed for a playoff because Brooks needed to merely two-putt from 25 feet for a tie.
But he rolled his putt 5 feet past the hole, then missed the comebacker as the gallery groaned.
"That was one of the few I hit past the hole all week," Brooks lamented. "The rest were short, short, short. If had putted good today, I would have won by three or four strokes."
But he didn't and Gilder had a long awaited victory, ending a drought of four years, eight months and 13 days since winning at the Constellation Energy Classic. His best finish previously this year had been a tie for 56th.
"I thought it was going to be a playoff," Gilder said. "That's not a good way to lose it for Mark. It's not a fun way to lose."
Trailing by four through 14 holes, Gilder shaved off a stroke on each of the next two holes with birdies, then got to within a single stroke of the lead when he parred 17 while Brooks bogeyed. Then came the dramatic 18th and one of the most memorable putts of Gilder's career.
"Until he hit into the water on 17, winning never really had entered my mind," said Gilder, who had only one bogey in the 54 holes.
Spittle played the last 48 holes without a bogey. He got himself onto the leaderboard by making four birdies and an eagle during a seven-hole stretch in the middle of his round.
"I could have had a few more out there and looking at the leaderboard, it would have helped," Spittle said. "But I played well. If you can shoot 65 or 66, that makes it fun for everybody."
After two early bogeys, Goodes birdied seven of his last 12 holes to keep pace with Spittle, his playing partner. His highlight: A long chip for birdie on No. 17 after hitting into the stands.
"That was the only good shot I hit on that hole," he said. "That's the way golf is. Sometimes it only takes one."
Calcavecchia was tied for the lead through 7, but bogeyed the par 5 No. 9 hole to fall three back and saw his hopes of a late run end with bogeys on the final two holes.
Defending champion Nick Price closed with a 66 to finish six back. Price had recorded nine straight rounds in the 60s in this tournament before shooting a 71 on Saturday.
Keith Fergus tied the tournament record with a 63, the best round of his Champions Tour career, after starting 76-73. He put up eight birdies in his bogey-free round, including four in a row on the front nine.
The difference? He left his allergy medicine behind.
"I think it kind of made me in a foul humor for two days," Fergus said. "So I just said, 'You know what, if I die of allergies, I'm just going to die.' I went out and I just played well and hit the ball and made some putts, felt a little more enthusiasm about my game."
A 63 was recorded three times previously in this tournament, most recently by Tommy Armour III in the first round last year.