Peterhansel, who experienced serious mechanical problems on Wednesday and lost his place at the top of the standings, came home 47 seconds ahead of Spain's former world rally champion Carlos Sainz, who had replaced the Frenchman in the overall lead.
Spain's two-time winner Marc Coma had earlier won the motorcycling stage.
Coma, eighth overall before the stage but who moved into fourth position following his victory, came in on his KTM motorbike at least 10 minutes clear of his rivals including France's overall leader Cyril Despres, who finished second.
Chile's fifth stage victor Francisco Lopez finished fourth on the stage behind Portuguese rider Helder Rodrigues.
The stage was marred by a serious injury suffered by Italian rider Luca Manca following a crash. Manca, ninth overall going into the stage, was flown by helicopter to hospital.
The 29-year-old KTM rider - whose ambition for the race was to finish in the top five and who rated the level of danger of the race a seven out of ten - crashed just 10 kilometres into the 418km special from Antofagasta and after receiving treatment had to be taken to local hospital by helicopter.
However after an initial diagnosis indicated he had head injuries he was due to be transferred to a neurological unit at a hospital in the capital Santiago.
Results of the sixth stage of the Dakar Rally on Thursday, a 418km special from Antofagasta:
Drivers
1. Stephane Peterhansel (FRA/BMW) 4hr 23min 55sec, 2. Carlos Sainz (ESP/Volkswagen) at 47sec, 3. Mark Miller (USA/Volkswagen) 8min 55sec, 4. Nasser Al-Attiyah (QAT/Volkswagen) 11:34, 5. Leonid Novitskiy (RUS/BMW) 17:32, 6. Nicolas Misslin (FRA/Stradale) 18:24, 7. Carlos Sousa (POR/Stradale) 21:29, 8. Giniel De Villiers (RSA/Volkswagen) 24:32, 9. Guerlain Chicherit (FRA/BMW) 24:48, 10. Krzysztof Holowczyc (POL/Nissan) 28:09.
Selected
17. Robby Gordon (USA/Hummer) 49:17.
Overall:
1. Carlos Sainz (ESP/Volkswagen) 20hr 35min 33sec, 2. Nasser Al-Attiyah (QAT/Volkswagen) at 15min 24sec, 3. Mark Miller (USA/Volkswagen) 17:47, 4. Carlos Sousa (POR/Stradale) 1hr 34:04, 5. Krzysztof Holowczyc (POL/Nissan) 1hr 43:40, 6. Robby Gordon (USA/Hummer) 1hr 48:25, 7. Guerlain Chicherit (FRA/BMW) 1hr 51:42, 8. Stephane Peterhansel (FRA/BMW) 2hr 04:02, 9. Guilherme Spinelli (BRA/Stradale) 2hr 12:18, 10. Leonid Novitskiy (RUS/BMW) 3hr 10:18.
Selected
16. Giniel De Villiers (RSA/Volkswagen) 4hr 14:32.
Motorcyclists
Stage:
1. Marc Coma (ESP/KTM) 4hr 46min 59sec, 2. Cyril Despres (FRA/KTM) at 10min 34sec, 3. Helder Rodrigues (POR/Yamaha) 10:38, 4. Francisco Lopez (CHI/Aprilia) 15:12, 5. Pal Ullevalseter (NOR/KTM) 17:09, 6. Ivan Jakes (SVK/KTM) 17:26, 7. Jakub Przygonski (POL/KTM) 20:27, 8. David Fretigne (FRA/Yamaha) 21:37, 9. Jonah Street (USA/KTM) 22:10, 10. Ruben Faria (POR/KTM) 27:59.
Overall:
1. Cyril Despres (FRA/KTM) 21hr 35min 59sec, 2. Francisco Lopez (CHI/Aprilia) at 42min 15sec, 3. Helder Rodrigues (POR/Yamaha) 44:05, 4. Marc Coma (ESP/KTM) 1hr 06:21, 5. Pal Ullevalseter (NOR/KTM) 1hr 14:42, 6. Alain Duclos (FRA/KTM) 1hr 21:56, 7. Jonah Street (USA/KTM) 1hr 24:22, 8. David Fretigne (FRA/Yamaha) 2hr 00:57, 9. Ivan Jakes (SVK/KTM) 2hr 07:39, 10. Olivier Pain (FRA/Yamaha) 2hr 08:46.