After Almeria's Jose Leonardo Ulloa was sent off in the 76th minute, Malaga wrapped up victory with goals from Jose Rondon and Juanmi. Malaga's Antonio Luna was red-carded in the dying minutes and visiting coach Jose Luis Oltra was also sent off.
Malaga climbed to 19th with 23 points from 25 matches, two short of safety but two ahead of Almeria who slipped to the foot of the standings. Malaga's first win in eight matches came after three successive draws but a relegation fight was not the ambition of Sheikh Abdullah Bin Nasser Al-Thani when he bought the club last year.
A member of the Qatari royal family, he spoke of a five-year plan to lead the modest club into the Champions League but they have spent most of the campaign in the bottom three.
Malaga started the season with a raft of new players and former Porto boss Jesualdo Ferreira at the helm but he only lasted until November when former Real Madrid coach Manuel Pellegrini was brought in.
They were La Liga's busiest club in the January transfer window with five new signings including Brazil's Julio Baptista and Argentina's Martin Demichelis.
The league's leakiest defence was quickly breached on Monday, hesitant goalkeeping leading to Feghouli firing Almeria in front.
Almeria sat back on their lead and eventually conceded seven minutes after halftime when Maresca beat Diego Alves low to his left.
Ulloa was sent off for elbowing and Rondon was gifted a free header to put Malaga in front, but Almeria ensured a nervy ending by hitting the woodwork twice in the closing stages.
Substitute Juanmi made sure of the three points in stoppage time after a glorious backheel from Apono.
Malaga's joy may be short-lived, however, with their next game a trip to play Real Madrid at the Bernabeu on Thursday.