Leaders Fluminense fell behind to a first-minute goal by striker Luan but scored twice in the last 10 minutes to earn the win and stay nine points ahead of Atletico Mineiro, who beat Sport 2-1 at home.
Captain Fred equalised for 'Flu' with a penalty harshly awarded for what looked like an unintentional handball by Luan.
With Ponte Preta down to 10 men after midfielder Wendel's dismissal for a second booking in the 83rd minute, central defender Gum headed the 89th minute winner from Wagner's free kick, awarded amid protests from Ponte Preta.
The free kick was given for a foul on Marcos Junior but television replays appeared to show the decision should have gone the other way with the Flu player the culprit, pulling his opponent's shirt before going down.
At the other end of the table, Palmeiras fell to their 18th defeat in 30 matches and are nine points behind Bahia, the lowest-placed team outside the bottom four who go down, and face their second relegation in 10 years.
Former Brazil coach Luiz Felipe Scolari left last month due to poor results but there has been little improvement under his successor Gilson Kleina.
Angry fans invaded the club headquarters during the week to protest against the directors, painting slogans on the walls, and travelling supporters also held a demonstration outside the team's hotel in Recife before the match against Nautico.
If Palmeiras are relegated, they will play in Brazil's second division in 2013 while competing for the Libertadores Cup, South America's elite club trophy.
Like Fluminense, Mineiro conceded an early goal, scored by midfielder Hugo, before recovering with a double from substitute Leonardo in the final 15 minutes including a 90th minute winner.
Sport, just a point and a place above Palmeiras, had scorer Hugo sent off in the 82nd minute for a foul on Leonardo Silva.
Two more Sport players were shown the red card after the final whistle for dissent after the referee denied their team a penalty.