All seemed comfortable for Latics as they raced into a two goal lead at half time. Dominic Poleon and Danny Philliskirk had handed them the lead at the break but two second half from Barnsley's Luke Berry and Sam Winnall sent the game to penalties.
Winnall missed his spot kick for the Tykes whilst Rachubka saved Kane Hemmings' drive before Turner smashed the winner to seal Latics' passage through to the next round of the competition.
Latics dominated proceedings in the first half with Conor Wilkinson, Poleon and Mike Jones causing threats in attacking positions.
The home side had their first opportunity on eight minutes as Danny Philliskirk fed Poleon who just fired wide from 10 yards.
James Dayton was the next to go close for Latics but Barnsley goalkeeper Ross Turnbull saved well from his low drive.
Poleon again tested the palms of Turnbull as he forced the stopper to save low from his rasping drive.
Barnsley could have taken the lead on 20 minutes but Conor Hourihane's strike from the edge of the area just went over Paul Rachubka's goal.
Latics took the lead on 22 minutes as Poleon fired home from eight yards. Joseph Mills drilled the ball in from the left and the striker struck home to give the home side the lead.
The home side created chance after chance with Wilkinson causing a real nuisance in attack but his shot just after the half hour mark went wide of the post.
The Tykes started to come back into the game and almost levelled the scores five minutes before the break. Sam Winnall got to the byline and looped the ball over the head of Rachubka but it rebounded off the post and away from danger.
Winnall tested Rachubka again seconds later but this time the goalkeeper stood tall and saved well from the striker.
Latics extended their lead on 44 minutes through Philliskirk. Wilkinson played a superbly weighted reverse ball into the path of the forward and he finished from 20 yards to put the home side two ahead.
Athletic started the second half well going close on three occasions through Philliskirk, Poleon and Wilkinson but neither could find a way past the former Chelsea stopper.
Barnsley pulled a goal back on 52 minutes through a powerful strike from Luke Berry. The midfielder lined up a shot from the edge of the area which gave Rachubka no chance.
The home side did not let the goal affect them and responded well. With just over 20 minutes of the game remaining, the ball was drilled towards Wilkinson who volleyed from the edge of the box but the goalkeeper saved comfortably.
Latics looked in control of the game with Michael Tidser looking impressive on his debut for the club.
Going into the final ten minutes of the game, Wilkinson fed Mike Jones on the right-hand side of the area but again, Turnbull was equal to the effort.
With only a minute of the game remaining, Barnsley managed to grab an equaliser through Winnall. The striker was allowed acres of space on the edge of the area and fired past Rachubka to send the game to penalties.
Philliskirk and substitute Liam Kelly confidently dispatched their penalties before Sam Winnall missed for the visitors.
Jones fired past Turnbull before Rachubka saved Kane Hemmings spot kick.
Wilkinson had a chance to win the tie for Latics but saw his penalty saved by Turnbull but substitute Turner struck the deciding spot kick to put Latics into the quarter final of the Johnstone's Paint Trophy.
Oldham Athletic: Rachubka, B.Wilson, J.Wilson, Dieng, Mills, Jones, Tidser (Kelly 86'), Dayton (Winchester 81'), Philliskirk, Poleon (Turner 79'), Wilkinson.
Subs not used: Brown, Coleman.
Barnsley: Turnbull, Brown, Dudgeon, Berry, Nyatanga, Treacy (Hemmings 54'), Hourihane, Winnall, Bree, Bailey (Abbott 85'), Williams (Cole 36').
Subs not used: Davies, Ramage.
Goals: Oldham Athletic (Poleon 22', Philliskirk 44') 2-1 Barnsley (Berry 52', Winnall 90')
Attendance: 2,502 (534 visiting supporters)