A 35-metre drop goal by Aberavon full back Richard Carter sent Premiership leaders Pontypridd crashing to their first away defeat since October 2012.
In an amazing game and with a strong wind, Pontypridd led convincingly by 27-6 until the last 24 minutes produced 23 points by the Wizards.
For the neutral it was an absolute thriller, but for both sets of supporters it was a nail-biter with defensive mistakes letting tries in.
Teenagers Jay Baker from Cwmavon and Lewis Evans of Resolven Youth gave vital contributions to the Aberavon cause.
But David Flanagan had landed two early Ponty penalties and a bounce went to centre Garyn Smith who ran over for Flanagan to convert.
Aaron Jones pulled back a penalty before a Dafydd Lockyer interception saw Flanagan cross and convert for a 20-3 half-time lead.
Though Jones struck with another penalty, a scorching run by the excellent Pontypridd forward Craig Locke brought a try that Flanagan converted.
Then, Ponty started getting the dropsies in defence and a hack on saw the flying Baker somersault over the line and Jones converted before following with a penalty.
Lewis Evans made his senior debut after 73 minutes and his first touch was a huge penalty from halfway.
Ponty came flying back but dropped the ball and when Steffan Andrews kicked for the corner, centre Matthew Jenkins won a thrilling race.
Evans had to have a holder in the wind but kicked a superb conversion at 26-27.
With a minute remaining a loose Ponty kick saw Andrews feed Carter who never hesitated before dropping a superb goal to put Aberavon ahead for the first time.
Still Ponty refused to die but in the last seconds Flanagan sent a drop shot well wide and it was over
Aberavon – Tries: J Baker, M Jenkins. Cons: A Jones 2. Pens: A Jones 3, L Evans. DG: R Carter.
Pontypridd – Tries: G Smith, D Flanagan, C Locke. Cons: D Flanagan 3. Pens: D Flanagan 2.