The defeat stopped third-placed Sao Paulo from splitting top two Vasco da Gama and Corinthians, who draw 2-2.
Six points separate the top six in the tightest title race for years. Vasco, still under caretaker coach Cristovao Borges since Ricardo Gomes's stroke last month, lead the way on 50 with Corinthians two points behind.
Sao Paulo are on 46, Botafogo 45 after a 2-0 defeat at Atletico Goianiense and champions Fluminense and Flamengo both a point further back.
More than 64,000 fans packed the Morumbi in Sao Paulo to welcome back Fabiano, who signed from Sevilla in March but has needed two knee operations.
"It was Luis Fabiano's party, but it was good to spoil the party because we needed these three points," Flamengo captain Ronaldinho said after their second successive victory following a bleak run of 10 matches without a win.
Fabiano, who previously played for Sao Paulo from 2001 to 2004, was denied an opening goal by a superb save from Flamengo goalkeeper Felipe.
Teenage Brazil forward Lucas left Sao Paulo a man short from the 55th minute when he was sent off for a second booking and Flamengo took advantage by snatching the lead with a Thiago Neves header 10 minutes later.
Flamengo also had a player dismissed when midfielder Willians was shown his second yellow card and Sao Paulo profited with a 79th minute equaliser from striker Dagoberto.
However, midfielder Renato stunned the Sao Paulo fans six minutes from time when his low shot took a deflection off a defender and wrong-footed goalkeeper Rogerio Ceni.
Fluminense beat Santos 3-2 in a thriller on Saturday with two goals coming in the dying minutes of the match.
Colombian striker Wason Renteria appeared to have snatched a draw for Santos in the 89th minute but defender Marcio Rosario headed the winner from a corner in stoppage time.