Ballymena United skipper Allan Jenkins fired in a late winner in a goal-packed game to send Portadown crashing to a third Premiership defeat in a row.
Jenkins had headed Ballymena into a 1-0 lead on the half hour with Marcio Soares sweeping in the equaliser.
Defender Gary Breen headed the Ports into the lead early in the second half but Stephen McBride got United level.
Sean Mackle restored Portadown's lead and David Cushley shot in Ballymena's equaliser in the 71st minute.
In the 90th minute Jenkins pounced to send a right-foot shot into the top corner to earn what was only a second win in seven league matches for Glenn Ferguson's visitors.
It was the second high-scoring encounter between the sides at Shamrock Park in a year as they drew 5-5 last season.
What they said
Ballymena skipper Allan Jenkins: "It was ebbing a flowing and looked like it was going to be a draw which would probably have been a fair result.
"But thankfully we broke up the pitch and managed to steal it in the last minute.
"It was difficult on the heavy pitch but they did well to get the game on.
"Our aim was to close the gap on Portadown and we have managed to do that."