As things stand, the Terriers would be relegated to League One due to their poor goal difference, while the Tykes would survive.
The visitors made the stronger start to the match, but O'Grady could only skew his shot wide from a tight angle in the ninth minute.
It didn't take long for the Tykes to go in front, and in the 16th minute O'Grady made amends for his earlier miss by cutting inside from the left before slotting a curling shot past Alex Smithies into the far corner.
Town again went close to an equaliser moments later, but Oliver Norwood's 20-yard effort flew just past the post.
The hosts had another opportunity just before the break, but Anthony Gerrard's header sailed just wide from Norwood's freekick.