Scotland international O'Connor's fourth goal of the season came with more than a touch of fortune after his 23rd minute shot deflected wickedly off North End defender Leon Cort and beyond Andy Lonergan despairing dive.
Lonergan came to his side's rescue on a number of occasions, but his botched clearance in injury time allowed Barnsley substitute Jacob Butterfield to break clear and leave Hayes with a tap in.
Brown set his stall out with an attacking 4-3-3 formation, but Preston rarely threatened Tykes goalkeeper Luke Steele' as on-loan Chelsea youngster Jacob Mellis dictated proceedings impressively on his debut.
Steele's best moment came two minutes from time when he dived full-length to palm away a swerving free-kick from Lilywhites substitute Keith Treacy.
Mark Robins' side have now lost just once in their past seven home games, while Preston are seven points from safety at the foot of the table.
Deadline day loan signings Mellis and Frank Nouble made their Barnsley debuts after joining from Chelsea and West Ham respectively, while Ian Ashbee and Leon Clarke pulled on Preston shirts for the first time.
Clarke should have opened the scoring in the ninth minute, but his faint back post touch on Billy Jones' in-swinging corner fell wide
Barnsley's first chance came in the 16th minute when England Under-19 international Mellis was given space to unleash a 25-yard drive that Lonergan could only parry.
With his goalkeeper floundering, Cort managed to muscle in front on O'Connor and hack clear from his own goalmouth.
O'Connor then got the better of Cort in the cruellest circumstances to give his side the lead after a surging run from on-loan Manchester City full-back Kieran Tripper had set up the Barnsley attack.
Steele saw his first action of the half 10 minutes before the interval when he saved well from Iain Hume's stinging 25 yarder.
A sweeping cross-field ball from the impressive Mellis instigated a Barnsley counter-attack in the 42nd minute, which resulted in Hayes being denied first by a last-ditch Conor McLaughlin block then a stunning Lonergan save.
Sean St Ledger and Jones entered the referee's notebook for ugly lunges on Nouble and Tripper as the second half opened in scrappy fashion.
Craig Morgan followed suit, hauling down Hayes shortly before he made way alongside Barry Nicholson for Treacy and Adam Barton as Brown looked to reinvigorate his floundering side.
Barnsley could have made it two when Tripper's 64th-minute free-kick found Diego Arismendi unmarked, only for the ball to bounce harmlessly off the Uruguayan midfielder's shins and into Lonergan's arms.
Clarke and Mellis were experiencing contrasting debuts - something underlined when the striker scythed through the back of his opponent, becoming the fourth Preston player to see Russell Booth's yellow card.
Barnsley ended the stronger of the two as Lonergan was forced to a trio of fine stops from Hayes, Nouble and Mellis in a frantic finish.
Then came Steele's finest moment from Treacy's set piece, before his opposite number's night ended in unfortunate fashion and Hayes sealed the points.