The striker scored twice and earned the penalty from which Callum Davidson got the other goal.
Victory all but ensured safety for North End with five games to spare.
It moved them on to 54 points, some achievement for a side who were bottom on New Year’s Day.
Just five weeks before this win, they had still been in the bottom three.
This was a fifth win in six games, the other one ending in a 0-0 draw with Blackpool.
Mellor got the nod to start this game in preference to Tamas Priskin who had been on international duty with Hungary.
Priskin, who was on loan from Watford, admitted to feeling tired after being with Hungary, and Mellor paired up with Chris Brown.
It followed a long spell on the bench for Mellor and the former Liverpool man was keen to make up for lost time judging by his display.
He was a constant thorn in the side of a Blades team who still had slim play-off hopes.
By the time North End had finished with them, those hopes had receded further.
After a frantic opening, the deadlock was broken in the 26th minute.
As Blades defender Matt Kilgallon and Mellor tussled for a ball in the box, Mellor went to ground.
Referee Clive Oliver gave a penalty, which looked a touch harsh. Davidson stepped up to take it and blasted it past United keeper Paddy Kenny.
In the second half, United had a goal disallowed when Stephen Quinn put the ball in the net when in an offside position.
Soon after that, Preston made it 2-0 with the first of Mellor’s goals.
He collected a pass from Chris Sedgwick and set off on a run towards goal.
Team-mate Simon Whaley at one stage tried to take the ball off his toe before Mellor drilled a low finish into the net past Kenny.
The visitors pulled a goal back in the 87th minute from the penalty spot.
For the second time that day Mr Oliver pointed to the spot when Billy Jones and Youl Mawene sandwiched Chris Morgan when they jumped to meet a cross.
James Beattie took the penalty and smashed it into the net past Andy Lonergan.
Six minutes went up on the fourth official’s board soon after, which offered encouragement to United.
But it was North End who finished strongly and got a third goal. It helped that the Blades went down to 10 men in the 93rd minute, centre-half Morgan shown a red card after the second of two bookings for fouls on Mellor.
North End were to wrap up the win in some style with the clock in the 97th minute.
Mellor chested the ball down on the halfway line and set off towards goal.
As he reached the edge of the box he hammered a shot past Kenny.
Reflecting on that goal, Mellor said: “A minute before, I had tried to run John Halls but he defended well.
“But I believed I could run him a second time, and in a one-on-one I fancied my chances.
“That was in the 97th minute so it was good to know I could still do it.”
Preston finished 15th in the table, drawing three and losing two of their last five matches.”