Glenavon secured a place in the top six for the Premiership split thanks to this victory over the Mallards.
Mark Patton found the bottom corner to put the visitors ahead and Ciaran Martyn's rebound finish made it 2-0.
James McKenna struck the Glenavon bar seconds before Mallards forward Jason McCartney saw his penalty hit a post.
Liam Martin pulled one back when his shot slipped through the grasp of Alan Blayney but Kevin Braniff netted a late penalty to seal the points.
Martyn squandered an early chance when the midfielder dragged a shot wide while Ryan Campbell was also wasteful at the other end, firing straight at Blayney.
Patton surged forward and stroked the ball home for a 14th-minute opener, while Mallards defender Liam McMenamin's saw his attempted clearance hit his own post.
Martyn made amends for his earlier miss by tapping in after Fergal Murphy blocked Braniff's shot.
McKenna rifled onto the bar and the referee spotted a Glenavon foul in the resulting goalmouth scramble.
McCartney was denied by the woodwork but Ballinamallard did score three minutes into the second half when Blayney fumbled Martin's shot into his own net.
Mallards midfielder David Kee volleyed wide and McMemamin shot straight at Blayney as the hosts pressed for an equaliser.
But Glenavon had the final say, with Braniff converting a spot-kick five minutes from time after McMenamin fouled Eoin Bradley.