The Dakar Rally's outcome appeared to be settled when the four Mini drivers leading the standings were instructed by their team to hold their positions, thereby setting up Roma to win the Dakar's car division 10 years after the Spaniard won the motorbike title when the rally was in North Africa.
Now Peterhansel, the most successful driver in Dakar history, could win the world's toughest rally for a 12th time.
The remarkable pace of the four down Chile's Pacific coastline made the team fear a crash would ruin their chance of a podium sweep.
The drivers followed orders on Thursday but attacked the 350 kilometre 12th stage from El Salvador to the Copiapo dunes on Friday, and left the title up for grabs on the rally's shortest leg, the 157 km ride to the finish at Valparaiso.
Roma, holding a measly five-minute lead, had a puncture early and was soon overtaken by teammates Peterhansel and Nasser Al-Attiyah of Qatar.
Roma also got stuck on a dune but again reeled in Peterhansel and Al-Attiyah.
I stopped on the dunes to show him that if he wanted to he could go past, but he didn't want to open the way on the dunes
Peterhansel offered to let Roma pass, but Roma stayed back, even when Peterhansel was ahead on overall time with 30 km to go.
"I stopped on the dunes to show him that if he wanted to he could go past, but he didn't want to open the way on the dunes,'' Peterhansel said.
"So I opened on the dunes and finished very calmly.''
Roma finally passed Peterhansel just 500 metres from the finish but Peterhansel, taking advantage of a navigation error by Al-Attiyah, won his third stage of the race, extending his Dakar record to 65.
After lying second to Roma for a week, he has the overall lead for the first time since the second stage.
But at 26 seconds, it was a mere eye blink in racing terms.
"The gap is small,'' Roma said.
"I'm still here and I'm happy.''
Al-Attiyah, with his eighth podium finish on a stage, remained third overall, 54 minutes back.
Former champion Giniel de Villiers of South Africa finished fourth and jumped Orlando Terranova of Argentina in the standings for fourth.
In the bikes race, Marc Coma kept the lead for an eighth day and looked set to ride to his fourth title on Saturday and make up for missing last year's race with a dislocated shoulder.
"It's like I'm fighting for myself to be focused, to push every day and just follow the way that brings me here,'' Coma said.
"So I'll carry on like that.''
His nearest rival, fellow Spaniard Joan Barreda Bort, had electrical problems 80 km (50 miles) from the end and walked his Honda over the finish line 2 1/2 hours after stage winner Cyril Despres.
Barreda dropped from second place to seventh. Second place was claimed by another Spaniard, Jordi Viladoms, who was two hours behind Coma.
Despres, the two-time defending champion, had a bad start to the rally but has climbed back up the standings with six straight podium finishes, including three wins this week.
The Frenchman is fourth overall and still has a chance to finish third as he is less than four minutes behind teammate Olivier Pain, who fell twice in the last 15 km.