He needed only to tap the ball into the net from close range in the 101st minute after Aymen Mathlouthi, under no pressure and with no other players in his immediate vicinity, dropped a cross right into the path of the grateful Ayew.
The match in the Gabonese provincial town descended into a niggly affair full of vicious tackles and on-field spats as Ghana held out to book a semi-final against Zambia in Bata on Wednesday.
Aymen Abdennour was shown a red card for a vicious elbow on an opponent in the 108th minute but a kung fu-style kick into the chest by Issam Jemaa soon after went unpunished by the Cameroon referee.
Ghana's Black Stars made a bright start as they continued their bid for a first Nations Cup title in 30 years when captain John Mensah scored with a header after just 10 minutes.
Mensah was returning after injury and grabbed his second goal of the tournament but was stretchered off again early in the second half after one of several bruising challenges that Tunisia got away with.
Tunisia, the last of the teams at the tournament from the traditional footballing powerhouse of north Africa, fought their way back to parity three minutes before half-time with Saber Khlifa bravely heading home after a clever lob pass from Zouhaier Dhaouadi when Ghana failed to clear their lines.
Ghana now head across to co-hosts Equatorial Guinea for their Wednesday meeting with Zambia, who defeated Sudan 3-0 on Saturday.
Earlier on Sunday, home team Gabon were eliminated in a penalty shootout by Mali after a 1-1 draw. Mali next meet the Ivory Coast.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.