Danny Purkis struck with two minutes to go to send Glentoran up to fourth place in the table as they edged out Ballymena United at The Oval.
Just when it looked like they would have to make do with a point Shay McCartan unlocked the resolute Sky Blues defence, picking out Purkis, who coolly finished past Jordan Williamson for only their second win in six games.
The hosts started on the front foot with Conor McMenamin curling an effort narrowly wide of the far post with only seven minutes on the clock.
Read next: Sam North full of praise for north Belfast derby in latest Footy Adventures
He turned provider two minutes later as his deep corner was headed wide of the same upright by James Singleton.
Aidan Wilson found himself in space at the back post on 11 minutes but headed straight at Williamson.
The Glens defender then made a telling intervention at the other end sliding in to block a David McDaid effort after Sean Graham had found him inside the box.
McDaid should have done better on 23 minutes when Rhys Marshall misjudged his clearance, the ball fell for the Sky Blues striker 10 yards out in front of goal, but he lashed his effort wide.
The half was in danger of petering out but as we moved towards the break both sides had chances again.
Kenny Kane fizzed a shot over from distance for the visitors before Purkis clipped the woodwork with a first-time effort from Bobby Burns' cross.
The Glens tried to force the issue again at the start of the second half.
McGinn linked up with Singleton in the opposition box, but Craig Farquhar did enough to block the Northern Ireland international's effort.
The Sky Blues were still posing a threat on the break though, again McDaid should have done better on 51 minutes as he got on the end of Kym Nelson's cross, but flicked his header over from six yards.
McMenamin looked the most likely to open up the Sky Blues as he was causing problems cutting in from the right, but his shot was straight at Williamson.
The hosts spurned a huge opportunity before the hour mark as Purkis headed McMenamin's centre back across the face of goal but somehow Singleton and McGinn both failed to make any contact with the ball for what would have been a certain goal.
McMenamin flashed another long-range effort past the upright on 67 minutes as the Glens continued to dominate possession.
In a rare break forward Kane stung Ollie Webber's hands after Glentoran had failed to clear their lines properly.
But there was to be a sting in the tail for the visitors as McCartan picked out Purkis to seal the points with a composed finish on 88 minutes.
READ NEXT:
- Second-half goals earn Blues BetMcLean Cup at Windsor Park
- Colin Murray pulls out of BBC Radio show over Gary Lineker row
- Larne boost squad for title run-in as they confirm deal for Dutch winger
- Lee Lynch reveals future goal for Coleraine after summer rebuild
Sign up to our free sports newsletter to get the latest headlines to your inbox.