Cork 0-23 Galway 2-15
Cork showed great tenacity as they overcame the first half dismissal of goalkeeper Donal Og Cusack to qualify for an All-Ireland quarter-final.
Despite the scoring exploits of Joe Canning (2-12), Galway were outgunned in tonight's fourth phase qualifier, played in front of a 30,082-strong Thurles crowd.
The Tribesmen led 2-05 to 0-09 at half-time with Canning scoring a late penalty after Cusack was sent-off for his second booking.
But Cork, inspired by 12-point hero Ben O'Connor, came good to set up a mouth-watering all-Munster clash with Clare.
Facing each other in the championship for the first time since the 2005 All-Ireland final, this was a game that both Cork and Galway's seasons rested upon and quite possibly the futures of their respective managers.
Galway boss Ger Loughnane altered his starting line-up before the throw-in, as was expected.
Full-back Fergal Moore was unable to start due to a hamstring injury but experienced forward Alan Kerins did come into the side after recovering from a toe injury.
Damien Joyce was moved to full-back but he had his problems there and was eventually replaced.
Cork's full-back Diarmuid O'Sullivan also struggled on youngster Joe Canning, who got the better of him for his first goal.
Loughnane's side got off to a poor start, going 0-04 to 0-00 behind with Cathal Naughton, team captain John Gardiner and Ben O'Connor (0-02) all on target.
Ten minutes in however, Canning, only playing in his third senior championship match, got Galway into contention as he shrugged off the challenge of O'Sullivan and sneaked a stunning shot past Donal Og Cusack for his first goal.
O'Sullivan was soon off to have a blood injury repaired but Cork held firm and did not let their early good work go to waste.
The in-form Joe Deane tagged on a point and Naughton did likewise to push the Rebels 0-6 to 1-0 ahead before Damien Hayes registered Galway's opening point, 20 minutes into the encounter.
It was nip and tuck as the game drifted towards half-time with both Ben O'Connor and Canning notching some impressive frees. Canning looked to have a goal chance as he stood over a 20-metre free but the 19-year-old wisely opted for a point.
A typical long range point from Gardiner had Cork 0-08 to 1-04 ahead but the game's first real turning point arrived in first-half injury-time.
A swift Galway attack ended with Kerins batting the sliotar to the Cork net but referee Barry Kelly had already blown his whistle before the goal was scored.
Kelly penalised Cork 'keeper Cusack for a foul on Kerins as the Galway forward tried to bulge the net. The foul earned Cusack his second yellow card, Cork were suddenly down to 14 men and they had a penalty to defend.
Cork manager Gerald McCarthy reacted by bringing substitute net minder Martin Coleman on for outfield player Naughton, but the new man in, flanked by two defenders, stood little chance as Canning rocketed the penalty to the back of the net.
O'Connor and Canning, the ace free-takers, swapped further points as Loughnane's charges took a 2-05 to 0-09 lead into the second half. Canning had 2-04 to show for the first 35 minutes.
Cork switched things around for the start of the second 35 as O'Sullivan was called ashore and Naughton was re-introduced.
With Ollie Canning their extra man, Galway ominously moved into a three-point lead with teenager Canning again to the fore.
But Galway struggled to pull away and Cork managed to heap the pressure on them with a run of six successive points.
Deane, who was a constant threat in open play, O'Connor and Naughton all helped themselves to scores as McCarthy's men found an extra gear.
Having beaten Antrim and Laois in their previous qualifiers this summer, this was Galway's first real test of the 2008 championship and when push came to shove, they failed it.
Cork almost nabbed a goal but substitute Pat Horgan, who was put through after a sizzling run by Jerry O'Connor, had his shot saved by Galway stopper James Skehill.
Ben O'Connor took his tally to 0-10 as he pointed to move Cork 0-18 to 2-09 ahead. With Galway amassing 13 wides by that stage, the Tribesmen looked rudderless and devoid of ideas.
Cork, who defended stoutly during the end-game, continued to look the livelier side with O'Connor soon putting them five points in the clear.
Predictably, Galway threw everything they had at their opponents in the closing 10 minutes. Niall Healy found his range and Richie Murray, going for goal, had his shot deflected over.
Canning tried his heart out, firing over three late points but O'Connor had the last word when he split the posts with a superb effort from near the sideline. Job done and Cork, after a disappointing Munster campaign, look back in business.
Scorers - Cork: B O'Connor 0-12, J Deane 0-04, C Naughton 0-03, J Gardiner 0-02, N McCarthy, P Horgan 0-01 each. Galway: J Canning 2-12, N Healy, D Hayes, R Murray 0-01 each
CORK: D Cusack; S O'Neaill, D O'Sullivan, B Murphy; J Gardiner (capt), R Curran, S O hAilpin; T Kenny, J O'Connor; P Cronin, N McCarthy, T McCarthy; B O'Connor, J Deane, C Naughton.
Subs used: P Horgan for T McCarthy, M Coleman for Naughton, C Naughton for D O'Sullivan.
GALWAY: J Skehill; D Joyce, D Forde, O Canning; S Kavanagh, J Lee, A Cullinane; F Healy, R Murray; I Tannian, K Hayes, A Kerins; D Hayes, J Canning, N Healy.
Subs used: C Dervan for Joyce, A Smith for K Hayes, A Callinan for Kerins, G Farragher for D Hayes, C Donnellan for F Healy.
Referee: Barry Kelly (Westmeath)