Flamengo started brilliantly on Thursday with goals from Hernane and Luiz Antonio in the opening eight minutes but the game changed when Fran Merida pulled one back for Atletico PR in the 21st minute.
The visitors then scored three more times after the interval to complete an impressive comeback.
The win increased Atletico PR's gap on fifth-placed Internacional to four points, after the latter lost 2-0 away to Bahia.
Atletico PR sit fourth on the league table with 38 points, equal with third-placed Gremio but trailing the Porto Alegre-based club on wins.
Gremio drew 1-1 with Santos on Wednesday.
At the Maracana in Rio de Janeiro, Flamengo hit the front in just the second minute when Rafinha headed a cross to Hernane to nod home from close range.
It was 2-0 just six minutes later after Paulinho showed great skill to bring down a long pass on the right-hand side of Atletico PR's defensive penalty area and then pulled the ball back to Antonio, who thrashed his shot past Weverton in the visitors' goal.
But after two early blows, Atletico PR recovered and Marcelo kick-started their comeback in the 21st minute, beating two opponents and then setting up Merida, who slid in to stab the ball into the net from close range.
The visitors were level nine minutes after half-time, when Everton's diagonal pass found Guilherme Dellatorre on the edge of the box and the 21-year-old striker produced a fine finish.
Atletico PR hit the front in the 78th minute after a counter-attack with Roger releasing Marcelo down the left to score.
Roger wrapped up the points three minutes later when he scored from a corner from six yards out.
The win was Atletico PR's first in four games, while Flamengo have lost four of their past seven games to sit 15th on the table.
In Bahia, Feijao and Fernandao scored in the second half as the hosts overcame International, while Portuguesa won the other game on Thursday, cruising to a 3-0 triumph over Nautico with three first-half goals.
On Wednesday, Brazilian league leaders Cruzeiro extended their lead at the top to seven points after a 3-0 win over second-placed Botafogo.
Cruzeiro edged ahead at home just before half-time when Nilton gave them the lead but the hosts had to wait until the last 10 minutes to wrap up victory with Julio Baptista coming off the bench to score in the 81st and 87th minutes.
In other results, Ponte Preta picked up their first win in eight games with a 2-0 triumph over Corinthians, Vitoria rallied late to overcome Vasco da Gama 2-1, Coritiba were held to a 2-2 draw by Goias, Sao Paulo edged Atletico Mineiro 1-0 and Fluminense trumped Criciuma 2-1.
Get the best features, fun and footballing frolics straight to your inbox every week.