Zaliukas cancelled out Gavin Reilly's opener when he headed home but his mistake allowed Queens to regain the lead through Iain Russell.
David Templeton finished brilliantly to level the scores within a minute of coming on as a half-time substitute and Mohsni headed Rangers in front in the 64th minute.
And Kenny Miller made sure of Rangers' third Scottish Championship victory four minutes from time when he notched the first goal of his third spell at Ibrox as he made his comeback from a hamstring injury.
Rangers had dominated possession and territory in the opening quarter but rarely threatened to get in behind or round the outside of the visiting defence.
And the Doonhamers, who were missing six injured first-team players along with the suspended James Fowler, shocked the 31,851 crowd in the 22nd minute by carving the home side open with just two passes.
Centre-back Mark Durnan played a ball up to the right to Dan Carmichael and the winger's pass inside found Reilly in yards of space inside the box. The striker guided the ball into the corner of the net past Steve Simonsen.
The shock jolted the home team into life and strikers Nicky Clark and Kris Boyd both had efforts on goal, the former shooting just wide from 22 yards and the latter forcing a save from a tight angle.
The hosts were level after Lewis Macleod's 27th-minute corner. The delivery found its way to Darren McGregor at the back post and his shot rebounded to Zaliukas after Zander Clark's point-blank save.
The Lithuanian's header somehow looped in despite Clark and two defenders guarding the net, with Boyd doing his best to unsettle them.
Boyd had a shot saved at the near post after good movement to meet a throw and McCulloch sliced a shot wide after another Macleod corner.
But Rangers fell behind again in the 36th minute. Zaliukas missed a header following a throw-in near the halfway line and Reilly slipped the inside for Russell, who had ample time to control the ball and steer it into the bottom corner.
Queens finished the half on top and Derek Lyle had a sight of goal when he breezed past Mohsni but could not get hold of his shot, which failed to find the target.
Ian Black and Templeton were half-time changes for Zaliukas and Arnold Peralta and the winger levelled after Macleod's pass to Boyd had put the visitors on the back foot.
The forward helped the ball on to Templeton and left-back Kevin Holt's slip allowed the winger to line up a shot and he blasted a 20-yard strike into the top corner with his left foot.
Rangers, with Lee McCulloch dropping into the back four in place of Zaliukas, began to exert some pressure and it paid off when Mohsni met Nicky Law's corner and guided a header that squirmed underneath Clark and into the net.
Lyle headed just over but got injured in a clash of heads with Mohsni in the process, forcing him off as Dean Smith came on.
Lewis Kidd also came close from distance but the Dumfries side could not mount a sustained comeback and Rangers came closer to scoring through Templeton and Law before Miller settled matters.
The striker, on for the injured Templeton, ran on to Boyd's header on following a kick-out by Simonsen and lifted the ball over the advancing Clark.