St Patrick's Athletic pulled off the great escape at Richmond Park as they avoided the relegation play offs with a win over south Dublin rivals Shamrock Rovers.
Ryan Guy headed the winner on 39 minutes and the victory, coupled with Galway United's draw with Cork City, means it is the westerners who will meet Drogheda United in Tuesday's one-off game. Sligo Rovers made sure of their survival with a home win over Drogheda United.
Rovers had beaten Pat's in three league and one EA Sports Cup games already this season and the hosts started with the look of a side with the intent of stopping that sequence.
But as has happened many times for them this season, excellent creative chances came to nothing. One of those events came on ten minutes when Bobby Ryan swung a perfect cross into the box but there was no one there to meet it.
Rovers threatened several times early on with one of the best when Graham Barrett found Paddy Kavanagh who in turn put the ball on a plate for Gary Twigg but the Scottish hitman was forced out to the corner by the Pat's defence and the chance was lost.
Pat's then put on a good display of football, making fans wonder why they didn't play like that over the previous 32 games of the campaign, before and Guy headed them in front on 39 minutes.
Glenn Fitzpatrick knocked the ball on to the Californian after Jason Gavin had a lash off target following a corner from the right and Guy popped up for his 6th goal of a long season in which he was playing his 45th game.
It could have been two before the break but Rovers keeper Alan Mannus stopped a brilliant shot from Stuart Byrne on 45 and Guy was denied with the rebound.
Pat's keeper Brendan Clarke saved from Craig Sives and Paddy Kavanagh early in the second half as Rovers pushed for an equaliser.
The Rovers wall blocked a Mark Quigley free on 58 while Mannus then made a decent save from Ryan and Fitzpatrick shot just wide on 71 as Pat's gave as much as they got.
A cracking move on 78 minutes saw Fitzpatrick feed Quigley who in turn put Guy in but his shot sailed over the crossbar as Pat's dominated the closing stages and the three minutes of added time to ensure Premier Division football for 2010.
Having played 49 domestic and European games this season the Saints round off their season against Derry City in the Setanta Sports Cup on Tuesday night while Rovers have Europa League football to look forward to in Tallaght Stadium next summer.
St Patrick's Athletic: 20 Brendan Clarke; 6 Damian Lynch (19 Noel Haverty 75 mins), 22 Enda Stevens, 5 Jamie Harris, 18 Jason Gavin; 17 Gareth O'Connor, 7 Stuart Byrne, 21 Ryan Guy, 14 Barry Ryan; 11 Mark Quigley, 12 Glenn Fitzpatrick (23 Declan O'Brien 80 mins).
Unused subs: 1 Gary Rogers, 10 Alan Cawley, 3 Darragh Ryan, Booked: Stevens 28 mins, Fitzpatrick 43 mins, Harris 67 mins.
Shamrock Rovers: 23 Alan Mannus; 19 Pat Sullivan, 5 Aidan Price, 6 Craig Sives, 14 Ollie Cahill; 7 Shane Robinson, 17 Ross Chisholm, 10 Stephen Bradley (21 Padraig Amond 76 mins), 13 Paddy Kavanagh (11 Sean O'Connor 63 mins); 9 Gary Twigg, 22 Graham Barrett (18 Dessie Baker, 63 mins). Unused subs: 16 Robert Duggan, 4 Darragh Maguire, Booked: Robinson 44 mins.
Referee: Alan Kelly (Cork).
