Ballinamallard gained revenge for their 11-0 mauling by Portadown in September by condemning Ronnie McFall's side to a fourth league defeat in five matches.
The Ports took the lead in the third minute when Darren Murray cut in from the right wing and fired a superb left-foot shot into the roof of the net.
The Mallards levelled on 58 when Emmett Friars scored an own goal, finding the net after a Jason McCartney corner.
Stuart Hutchinson fired in a powerful shot for the winner in the 81st minute.
The home side responded well to Murray's early strike, with striker Andy Crawford heading wide from a corner.
McCartney drilled a low shot across the face of goal before the break, while Fearghal Murphy proved equal to Peter McMahon's shot, producing a fine fingertip save to push the ball wide for a corner.
In the second half, Ryan Campbell saw his thumping effort cannon off the post and then the ball skidded off central defender Friars and into the net following McCartney's corner from the right 13 minutes into the second half.
Midfielder Hutchinson ran onto a ball from skipper Mark Stafford and unleashed a powerful shot to clinch three points for the Ferney Park outfit.
Portadown drop to sixth place in the league, with Ballinamallard moving up to seventh.