Barnsley and Swansea were forced to settle for a point each in an entertaining encounter at Oakwell.
Ayew's header on 70 minutes gave the Swans the lead but they were pegged back within 180 seconds as Alex Mowatt levelled for the hosts with a calm finish after a quickfire break.
Both goalkeepers made key saves and both sides missed excellent chances.
Despite the point Barnsley slip to bottom of the Championship, while Swansea sit fourth.
Barnsley are now winless in 13 games against Swansea in all competitions.
The hosts could have led inside 60 seconds but Cauley Woodrow was denied by exceptional save from Freddie Woodman after Swansea failed to deal with a long throw.
Barnsley were again close 10 minutes later, but Cameron McGeehan blazed over after Woodman could only parry Woodrow's effort.
Swansea did not register their first attempt until midway through the first half when Ayew's effort was saved by Bradley Collins, who also saved sharply to deny George Byers.
Ayew was the biggest threat for the Swans and he again tested Collins after the interval before McGeehan again fired over for the hosts from an encouraging position.
Swansea should have taken the lead just past the hour mark when Sam Sturridge was sent clean through by Matt Grimes' clever pass, but Collins again produced a fabulous save to keep the scores level.
Collins was looking unbeatable and he again produced a big stop on 64 minutes to deny Bersant Celina from point blank range after Ayew's teasing cross.
However, the momentum was with the Welsh side and they took the lead when Ayew headed home after Celina's shot was blocked by Collins on 67 minutes.
Swansea failed to hold their concentration though and Mowatt swept home to boosts the Tykes.
Swansea manager Steve Cooper told BBC Sport Wales:
"I think having got through the first hour and then taken control of the game, to go 1-0 up and then concede as we did, we are obviously going to be quite frustrated at that.
"A point from home is never the worse thing in the world... but we should have gone on and won the game.
"We could have started the game better, but we played good football in the second half. We are disappointed to only score one goal.
"Andre Ayew has got three goals in as many games and that is good for us. We are really happy with him."