Portadown had to wait until a last-minute goal from Kyle Neil before ensuring a passage into the sixth round of the Nationwide Irish Cup. The victory will now see Portadown at home to Newry City in the last 16.
Paddy Quinn had given Ronnie McFall's side the lead in the 38th minute, but Glenavon made the Premier side struggle at Mourneview Park.
Quinn, a former Glenavon player, had earlier clipped the crossbar with a long-range effort.
Portadown finally made the breakthrough in the 37th minute when Wesley Boyle did the spade work and his effort was touched in by Quinn.
After much huffing and puffing, Portadown made sure of success when Glenavon goalkeeepr Andy McDonald gifted the second goal to Neil.
Fifth round results
Linfield 1-1 Institute
Glenavon 0-2 Portadown
Lisburn Rangers 0-6 Glentoran
Lisburn Distillery 4-1 Ballinamallard
Loughgall 5-1 Donegal Celtic
Omagh Town 0-1 Crusaders
Tobermore 0-2 H&W Welders
Carrick Rangers 1-5 Coleraine