Hull squandered a chance to secure promotion to the Barclays Premier League as Barnsley took advantage of the Tigers' end-of-season jitters to boost their survival prospects.
It means Steve Bruce's men, now without a goal in three and desperately out of form, hold a one-point advantage over third-placed Watford going into the final round of fixtures, with champions Cardiff heading to the KC Stadium next Saturday.
The Tykes, meanwhile, ended a six-match winless run thanks to early goals in either half from Mellis and O'Grady, and will guarantee Championship football for next season should they defeat fellow strugglers Huddersfield.
It was the hosts who struck first after four minutes when Mellis was fed by O'Grady inside the area and, although the angle was against the midfielder, he smashed the ball in via the underside of the crossbar in front of the travelling contingent.
Hull's frustrations were growing and they spilled over just before half-time when Matt Fryatt was denied a free-kick after tangling with David Perkins. The latter squared up to the Tigers striker and the two became involved in a pushing contest in which arms were raised, although referee Chris Foy neglected to use a card of any colour.
The hosts nearly entered the interval two goals ahead when teenager Reuben Noble-Lazarus set off on a driving run from the halfway line which culminated in a weak effort being dragged wide.
Hull failed to alleviate the pressure, though, and the hosts doubled their advantage five minutes into the second period through O'Grady's sweet strike.
With Chris Dagnall looking for options, O'Grady took the ball off his strike partner's toes and arrowed the ball straight into the bottom corner of the net.
But they were left feeding off scraps, Perkins doing well to block Jay Simpson's shot in the six-yard box before Nick Proschwitz somehow failed to connect with a header from a similar range.
The German striker, much maligned among Hull supporters, did manage to get his head on to a Simpson flick-on shortly afterwards but the ball sailed over.
Paul McShane continued to prove a threat from set-pieces and nodded narrowly over from a corner, but Barnsley held on leaving the two sides with contrasting emotions ahead of their respective crunch final fixtures.