NUIG surrendered a four-point lead and only managed to score one point in the second half as St Mary's set up a Sigerson Cup quarter-final clash away to DCU.
Matthew Fitzpatrick bundled home a fifth minute goal for the Belfast college, but they were second best as the Galway side ran up a 1-6 to 1-2 lead.
Damien Comer caused problems early on before Antrim's Owen Gallagher hit the net against St Mary's after 21 minutes in Glenavy.
NUIG were far too wasteful kicking eight wides in the second half. St Mary's took full advantage, playing with more adventure after their cautious first half and pushing up.
Fermanagh's Ciaran Corrigan scored two points in a minute and Crossmaglen's Oisin O'Neill fisted over the equalisier.
Galway's impressive Mikey Daly briefly restored NUIG's lead with his second point from distance, but St Mary's rattled off the last three points in the closing seven minutes from Kevin McKernan and Tyrone subs Conal McCann and Darragh Kavanagh.
scorers – St Mary's: M Fitzpatrick 1-0, C McShane, C Corrigan 0-2 each, C Meyler, O O'Neill, C McCann, K McKernan, D Kavanagh 0-1 each. NUIG: O Gallagher 1-0, M Daly 0-2, E Tierney, D Comer, R Greene, S Kelly 0-1 each, A Gallagher 0-1 (f).
St Mary's – M Reid; J Hannigan, A McKay, K Mallon; C Byrne, M O'Hare, C Meyler; D McConville, O O'Neill; C Corrigan, K McKernan, J Colton; S McConville, M Fitzpatrick, C McShane.Subs: C McCann for Colton (23), R Mooney for O'Hare (24), B Og McGilligan for D McConville (HT), D Kavanagh for Fitzpatrick (41), C MacIomhair for Hannigan (50), C Quinn for Corrigan (51).
NUIG – T O'Malley; S Brennan, E O'Donoghue, A O'Connor; S Kelly, K McDonnell, L Burke; E Tierney, P Cooke; S Conroy, M Daly, A Gallagher; R Greene, D Comer, O Gallagher.Subs: J Donoghue for Conroy (24), M McClean for Kelly (30), R Forde for McClean (53), D McCormack for O Gallagher (55), C Kelly for McDonnell (58), C Bonner for Greene (57).
Ref – Paul Faloon (Down).
Video by Jerome Quinn Media for Higher Education GAA.