Ian Parkhill struck in the final minute to clinch a dramatic victory for Coleraine against the Lurgan Blues.
Neil McCafferty curled in a free-kick to put the visitors ahead before Ciaran Martyn headed home an equaliser early in the second half at Mournview Park.
Shane McGinty fired Coleraine back in front only for Eoin Bradley to net the rebound after his penalty was saved.
Parkhill slotted in the late winner before Bannsiders defender David Ogilby was sent-off for two yellow cards.
Glenavon player-manager Gary Hamilton saw his half-volley brilliantly saved by Michael Doherty and Rhys Marshall headed wide as the hosts created the better early chances.
However, Coleraine made a 36th minute breakthrough with McCafferty curling his 30-yard free-kick over the wall and into the bottom corner.
Glenavon were level two minutes after the restart when Coleraine failed to clear Hamilton's cross and Martyn nodded the ball just over the line.
McGinty's quality strike made it 2-1, a fierce 12-yard shot flying across keeper James McGrath and into the top corner.
The late drama started with Bradley's spot-kick on 88 minutes, awarded for handball, as the striker found the net at the second attempt after Michael Doherty's save.
Coleraine's produced the winner from the restart, with Parkhill nipping in before sliding the ball under McGrath and into the net.
Ogilby was dismissed in injury time as Coleriane secured a win which takes them above Glenavon and into sixth.