Switzerland's Sebastien Buemi, last year's victor in the Moroccan city after Rosenqvist had started on pole, finished second for Renault e.dams with Britain's Sam Bird third for DS Virgin Racing.
Buemi finished the race in second place, with Bird claiming the last place on the podium.
Sweden's Felix Rosenqvist took the lead in the Formula E championship for the first time on Saturday after winning the third race of the season in Marrakesh for India's Mahindra Racing.
Starting from pole, Buemi led in the early stages, with Bird hot on his tail, but when Rosenqvist made his move to snatch second midway through the race, he had a new challenger to contend with.
A full-course yellow was deployed a lap later with the leaders, minus Jaguar's Mitch Evans who had just stopped from sixth and therefore plummeted down the order, still on track.
Piquet struggled in the opening stint and fell behind Jose Maria Lopez, but jumped the Dragon Racing replacement driver in the vehicle swaps and flew in the second half of the race to ease clear of Jean-Eric Vergne.
Maro Engel finished seventh but a post-race drive-through penalty saw him relegated to 13th.
As a result of the accident, Formula E debutant Tom Blomqvist scored points for Andretti by finishing in ninth while Nico Prost finished in tenth place in the second Renault e.dams auto.
That meant Mortara failed to finish, joining Oliver Turvey - who only had one usable vehicle after getting wheeled off the grid - Andre Lotterer and Lucas di Grassi in retirement.
Reigning Formula E champion Lucas di Grassi did not score any points after being forced to retire with a battery management issue.
With the lights green, a relatively clean Turn 1 followed, proving problematic only for DS Virgin Racing's Alex Lynn, who spun into the runoff area after Audi Sport ABT Schaeffler's Daniel Abt collided with him.