Lorenzo, starting from pole, took control of the race early on, but Pedrosa - who had started from fifth after a crash in qualifying - stormed to second place by the first corner.
Pedrosa took the lead on the 13th lap and looked set to hang on, but Lorenzo took the lead half-way through the final lap and seemed set for victory.
Yet the race had one final twist as Pedrosa's superior power up the hill gave him greater speed going into the last two corners, and he went past on the final complex of two turns to secure victory.
"Very good riding I think today - Jorge had his strong points and I had mine," said Pedrosa. "I knew just a small mistake from me would let him take over."
"Dani was more clever, and more brave - congrats to him," said Lorenzo after the race.
Britain's Cal Crutchlow, who started from second on the grid, ran in third place from start to finish to take his maiden podium place in MotoGP.
The Briton was not quite able to live with the pace of Lorenzo and Pedrosa, who stretched out into the distance - Lorenzo initially ahead until Pedrosa dived down the inside at the penultimate corner at mid-distance.
Lorenzo opted to tuck in behind Pedrosa until the final lap, when he attacked and stole ahead in the stadium complex.
Down the back straight Pedrosa responded, but Lorenzo stuck with the outside line and once again forged ahead, only to run wide and compromise his line into the final turn, allowing Pedrosa to come back through and claim the win.
The dice was all the more significant in the championship after Casey Stoner's decision to leave Brno and return home for ankle surgery.
The battle behind was never as close, with Andrea Dovizioso trailing Tech 3 stablemate Crutchlow by around two seconds for much of the race.
He was nevertheless close enough to pounce if Crutchlow made an error in the final laps, but with none coming had to settle for fourth. Crutchlow's podium is the first for a Briton since Jeremy McWilliams finished third at Donington Park 12 years ago.
After his best qualifying performance of the season, there were early signs that Ducati's Valentino Rossi might feature in the podium fight when he passed Dovizioso and Ben Spies on the opening lap.
As the race progressed however his pace did the opposite, and he eventually fell to seventh behind the satellite Hondas of Stefan Bradl and Alvaro Bautista.
Spies meanwhile endured another torrid race. He fell back to 13th over the opening two laps with a slipping clutch, charged back to eighth when the problem eased but then crashed out in the stadium section with 14 laps to run.
Lorenzo still leads the championship on 245 points, with Pedrosa now just 13 points back in second place.
Marc Marquez gave his 2012 Moto2 title hopes a significant boost with victory in a cagey four-way fight at Brno that exploded in the final laps.
For much of the contest the battle for victory was a slow burner, as cold circuit conditions seemed to limit the pace, if not the ambition, of the front pack.
With Scott Redding making a poor start from third and then crashing out at Turn 3, a lead quartet of Thomas Luthi, Pol Espargaro, Marc Marquez and Andrea Iannone formed and gradually pulled away from the field.
Luthi's lead went unbroken, although not unchallenged, until three laps from the flag, when Marquez finally found a way through.
Interwetten-Paddock rider Luthi came back immediately - and was in turn immediately repassed - and attacked again on the final lap, but he was unable to prevent Marquez from taking his sixth win of the year on the Monlau Suter.
The Spaniard's championship lead now stands at 48 points with six races to run.
His nearest rival Espargaro was also a fixture in the closing laps but, just as he closed in on Marquez, he was instructed to cede position to Iannone when it was discovered he had passed the latter under yellows.
It was perhaps unintentional that Iannone attacked and found a way through shortly after, and while Espargaro fought back past, he lost crucial yards in doing so and had to settle for third, with the Italian less than one tenth of a second down the road.
Simone Corsi also had a long battle for fifth, first with Nico Terol and later at the head of a six-way scrap.
He held on to finish ahead of Alex de Angelis, Johann Zarco and Bradley Smith.
Jonas Folger claimed his first Moto3 victory with a dominant ride in tricky conditions at Brno.
Overnight rain led to a greasy, patchy surface for the start of the race, prompting some - most notably Efren Vazquez - to gamble on wets. The conditions also forced the championship's main protagonists to be cautious, the front order hugely mixed as a result.
Vazquez predictably flew in the early stages, storming into a four-second lead within two laps, but by lap four the advantage had swung to slicks and the Laglisse Honda slipped back relentlessly as the race wore on.
Folger had been the only rider to stay near Vazquez early on, and then reaped the rewards of being the most aggressive rider as conditions began to improve, often lapping two seconds faster than the rest of the field.
He disappeared down the road as a result, building a lead of 12s by the halfway mark which he maintained until the finish to claim his first series win in only his second race after replacing Alberto Moncayo at Aspar.
For a while it seemed the Czech fans would be able to welcome two home riders onto the podium, as Jakub Kornfeil (Ongetta FTR-Honda) and wildcard Mirsolav Popov (Mahindra MGP30) - who had started 29th – held second and third.
Halfway through however Sandro Cortese (Ajo KTM) and Maverick Vinales (Avintia FTR-Honda), now assured of dry conditions, began their charge, bring Luis Salom (RW Kalex-KTM) and Alex Rins (Monlau Suter-Honda) with them.
With two laps to run the quartet finally caught Kornfeil, setting up a thrilling five-way last-lap battle.
Cortese appeared to be destined for second but on the penultimate corner Salom dived down the inside to snatch second. Cortese was still able to extend his points advantage over Vinales, who finished directly behind him in fourth.
Kornfeil, who came just two laps short of securing a maiden Moto3 podium on home soil, had to settle for sixth behind Rins, while Popov fell four laps from the end.
Wildcard John McPhee (Racing Steps) had also impressed early on, jumping from 19th to fourth, but eventually dropped to 15th as conditions improved.