A late strike from George Moncur handed Barnsley the three points in the opening group game of the Checkatrade Trophy.
Sam Surridge had put Latics ahead before Victor Adeboyejo levelled late in the first half.
It was a nervy start to the game with neither sides’ defence giving the opposition attack any space to create an opening.
No wonder the first opportunity came from a freekick as stand-in Captain Andy Taylor forced a save a smart stop from Jack Walton in the Barnsley goal.
Adeboyejo had the visitors first chance as the ball broke through to him in the box and he forced a good save from debutant Zeus De la Paz.
Callum Lang had a great chance to open his Oldham account later in the half as Barnsley didn’t deal with a Tom Hamer long throw, but the Wigan loanee scuffed the shot into Walton’s hands.
Good play down the right-hand side from Hamer and Jonathan Benteke presented another chance to Lang, but this time he couldn’t keep his header down.
Latics took the lead after a long ball wasn’t dealt with and Surridge outmuscled Liam Lindsay before slotting it past Walton.
The South Yorkshire side equalised just before the half ended as it broke through to Adeboyejo in the Oldham penalty area and he poked it into the bottom corner to take the teams in level at half time.
Manager Frankie Bunn made early changes in the second half as Chris O’Grady and Jose Baxter were both introduced.
Barnsley were caught sleeping after the O’Grady substitute as they switched off from the restart from a throw in and Walton saved well from Benteke before Taylor volleyed the rebound over.
Both teams created half chances as Cameron McGeehan put a free header over the bar and Johan Branger-Engone hit the side netting.
However, the visitors took the lead after Latics failed to deal with a ball on the edge of the box and substitute Moncur picked his spot and smashed it into the top corner.
Latics almost took the game to penalties in the dying seconds as Taylor crossed in for Benteke who’s powerful header was saved brilliantly by Walton.
Unfortunately, it wasn’t to be for Latics who must pick themselves up for the crucial clash with Newport County on Saturday afternoon.
Attendance 1786 (443 Away)
De La Paz, Hamer, Graham, Edmundson, Taylor ©, Branger-Engone, Missilou (Baxter 57’), Maouche, Benteke, Lang (Gardner 84’), Surridge (O’Grady 60’)
Walton, Lindsay (Pinnock 45’), McGeehan, Isgrove, Bird, Jackson ©, Bahre (Moncur 83’), Williams, Adeboyejo, Brown