Last year’s treble winners have not been the same force since suffering a 56-12 mauling at Widnes in round two, a damaging result that left them short on confidence and facing an injury crisis.
Back-to-back wins had given the Rhinos hope of making the top eight but they let a 22-10 lead slip as the Vikings earned their first triumph at Leeds since 2002.
Kallum Watkins, Ryan Hall, Joel Moon and Mitch Garbutt crossed for the Rhinos while Corey Thompson, Mellor, Patrick Ah Van and Rhys Hanbury went over for Widnes, who are all but guaranteed a top-eight spot.
Leeds were well rested after a rare weekend off and they enjoyed a strong start against a Widnes side knocked out of the Challenge Cup by Warrington last Friday.
The Rhinos had already gone close on a couple of occasions by the time Watkins benefited from soft tackling to crash over for his eighth try in seven games against the Vikings.
It was the eighth game in a row Leeds had taken an early lead but, as on many occasions previously, they failed to build on their good start and were pegged back.
Mellor had let Leeds off the hook by dropping the ball over the line under little pressure but Widnes did not have to wait much longer for their first try as Thompson dummied his way over out wide from Kevin Brown’s pass.
Hanbury missed the conversion and the Rhinos restored their six-point advantage when England winger Hall, on his first start since mid-March, touched down after Stefan Marsh appeared to duck out of the way of Danny McGuire’s cross-field kick.
Leeds were enjoying rare dry conditions at Headingley and they crossed again through Moon at the end of a fine team move that Brett Ferres launched with an offload inside his own half.
Liam Sutcliffe added his second goal of the afternoon to make it 16-4 but Widnes responded positively to the back-to-back tries and were back in it seven minutes from the break.
The Rhinos were forced to defend successive sets on their own line and they eventually cracked as Mellor atoned for his earlier blunder by going through a big hole in the defence to score next to the posts.
The Vikings ended an entertaining first half trailing by only six points but they were up against it after Garbutt powered his way over close to the line and Sutcliffe added the extras.
Widnes again came back at the Rhinos hard and they were back on level terms after quick-fire converted tries from Ah Van and Hanbury.
The returning Ashton Golding denied Thompson with a try-saving tackle but a long Brown pass put Ah Van over in the corner before Hanbury touched down after Luke Briscoe spilled Mellor’s spiralling kick.
Leeds won the territory battle in the closing stages but they failed to find a winning score and Mellor punished them by sending over a long-range one-pointer to the delight of the travelling Widnes fans.