Tomer Hemed's early opener for Mallorca was overturned by goals from Paco Montanes and Helder Postiga, but the Balearic islanders looked to have nicked a point when Javier Arizmendi scored seven minutes from time.
However, in a thrilling finale, Ruben Rochina fired Zaragoza back in front before Arizmendi had a second 'goal' ruled out for offside.
The result ended a run of 10 league matches without a win for Zaragoza but, more importantly, lifted them above their opponents who now prop up the standings.
Mallorca showed willing in the early stages and they were in front after 10 minutes at La Romareda, Giovani dos Santos the creator with a free-kick which was pumped into the box for Hemed to head home from close range.
The visitors then threatened to add to their lead after 17 minutes with a strike from Alejandro Alfaro which flew past the right post.
Zaragoza began to stir soon after and Antonio Apono gave the home fans hope with a header which was just off target.
Victor Rodriguez then drilled an attempt over the bar after 26 minutes but Mallorca's defence was breached two minutes later by Montanes, who was accurate with his right foot from 12 yards.
That sparked a spell of pressure from Zaragoza and visiting goalkeeper Dudu Aouate had to punch clear a shot from Adam Pinter before making an even better save to keep out a header from Lozano Rodri on the half hour.
Home goalkeeper Roberto also saw some action before the first half was out, turning away Alfaro's effort with his feet to keep the scores level.
Giovani tried to give Mallorca the edge again after 58 minutes with a left-footed strike from distance which was narrowly wide.
And Zaragoza responded with a goal of their own two minutes later, with Rodriguez whipping in a cross which Postiga nodded into the bottom left corner for his 12th of the season.
The visitors immediately pressed for an equaliser but Arizmendi was wasteful with his effort while Hemed combined with Giovani once more, only to put his header over the bar.
The scores were level seven minutes from time, though, following a defensive blunder. Roberto left his goal to meet the ball but a mix-up with his defence allowed Arizmendi to nip in and fire home from a tight angle.
However, there was more drama to come as Zaragoza nicked a third goal three minutes from time, with on-loan striker Rochina holding off pressure from a defender to run into the box and tuck away a low shot.
And with four minutes of stoppage time being played, Arizmendi saw a header palmed away one-handed by Roberto before the midfielder bundled the resulting corner into the back of the net, only to see his effort ruled out for offside.