The visitors went ahead as early as the second minute when George Boyd found the target from just six yards with a left-footed shot.
Three minutes later Barnett tried his luck with a shot, but he was denied by Ben Alnwick in the Barnsley goal.
Ten minutes into the second half, Olejnik was called into action as he had to keep out John Stones's attempt for the hosts.
Two minutes later Tomasz Cywka tried his luck on the Peterborough goal, but once again Olejnik was up to the task.
Cywka went close in the 77th minute with a free kick, but Olejnik pulled off a comfortable save bag Peterborough maximum points at the Oakwell Stadium.