McGehee, who has delivered plenty of clutch hits this season, started a celebration Sunday with an out.
He tied the game in the eighth inning with a two-out, two-run double, then drove home the winning run with a sacrifice fly in the 10th, and the Marlins averted a series sweep by beating the Pittsburgh Pirates 3-2 Sunday.
Miami earned its sixth walkoff win and broke a three-game losing streak. McGehee was glad to be at the center of the postgame mob scene.
"It's one of those feelings you can't really describe," he said. "It's a special feeling because you've been grinding for however many innings. It's a sudden relief -- there's nothing like it that I can imagine."
The Marlins gave McGehee a chance to return to the majors after he spent 2013 in Japan, and he has repeatedly rewarded their faith.
He leads the majors with 30 hits with runners in scoring position, and he's batting .411 in those situations, often coming through after opponents pitch around slugger Giancarlo Stanton.
"Casey has gotten some huge hits for us," manager Mike Redmond said. "I think he's grateful for the chance he has been given here, and he has made the most of it."
The Pirates had won four in a row and were on the verge of their first three-game series sweep in Miami since 1993. Vance Worley pitched seven innings in his season debut and left with a 2-0 lead.
But the Marlins tied the score in the eighth when McGehee doubled off Tony Watson, who entered the game with a streak of 21 1-3 consecutive scoreless innings.
"With the way Vince pitched, you always feel bad not being able to hold the lead for him," Watson said. "But Casey is a good RBI guy this year. That's what he does, and he made me pay. Sometimes to have to tip your hat."
Miami scratched out the winning run in the 10th against Jared Hughes (3-2). Rafael Furcal fouled a ball off his left knee and tumbled to the dirt in pain, but stayed in the game long enough to hit a leadoff single. Pinch runner Ed Lucas advanced on a sacrifice, and Stanton was intentionally walked for the 13th time this year.
Both runners advanced on a wild pitch, and McGehee's fly to right field scored Lucas without a play. That gave McGehee 43 RBIs, which ranks among the NL leaders.
"I've seen how quick things can go south if you start patting yourself on the back," he said. "At the end of the year I can evaluate how I did, but right now I'll keep my head down and try to do my job."
Miami's A.J. Ramos (4-0) kept the score tied in the 10th after loading the bases with none out. On a 3-2 pitch, Russell Martin grounded into a 5-2-3 double play started by McGehee, and Clint Barmes struck out to end the threat.
"I can't say enough about A.J. getting out of that situation," Redmond said. "I would have loved to have not seen him get into that situation, but for a young guy he made some great pitches and buckled down when he really needed to."
Rookie Gregory Polanco, who is batting .387 after a week in the big leagues, had two hits and joined some exclusive company. He's the first Pirates player to get a hit in each of his first six games since Roberto Clemente in 1955.
Furcal said he expected to be able to play Monday despite his sore knee. ... Marlins RHP Nathan Eovaldi went on the paternity list before the game and left for Texas to be with his wife for the delivery of their first child. He's expected to start as scheduled Wednesday against the Cubs. Miami recalled RHP Sam Dyson from Triple-A New Orleans. ... The Pirates optioned INF Michael Martinez to Triple-A Indianapolis. ... Marlins LF Christian Yelich (back) missed his second game in a row and could be headed for the disabled list, manager Mike Redmond said. ... Pittsburgh begins a three-game homestand Tuesday when RHP Brandon Cumpton (2-2, 6.06) starts against Cincinnati RHP Johnny Cueto (6-5, 1.85). ... The Marlins open a three-game series at home Monday against the Cubs when RHP Tom Koehler (5-5, 3.68) starts against RHP Jason Hammel (6-4, 2.81).