Ipswich Town 2 (Berra 81, McGoldrick 84)
Barnsley had three points in the bag but threw it away as Ipswich snatched two goals in the space of four late minutes.
Danny Wilson's hand was forced to bring in Stephen Dawson and Jim O'Brien into central-midfield with the suspension of Emmanuel Frimpong and Jacob Mellis.
On six minutes the Reds' first chance was a glorious one as Dawson robbed Hunt on the edge of the area to play in O'Grady but he scuffed his effort wide from 12 yards.
Six minutes later O'Grady made amends with a wonderful finish on the turn. When it seemed the chance had gone with his back to goal, he turned on a sixpence to curl past a stranded Gerken into the bottom corner.
With 18 gone Aaron Cresswell bent in a brilliant 25-yard free-kick that rattled the upper part of Luke Steele's left-hand post, whilst Reds Manager Danny Wilson was still raging over Chris O'Grady not being awarded a free-kick just seconds earlier.
The Reds almost made it two but for a scramble in the 18-yard box after Jennings carried his side forward to O'Grady and Proschwtiz who both had a stab at it but Ipswich cleared the danger.
Three minutes before the break, Tommy Smith got on the end of an out-swinging corner but couldn't direct it on target. It was Ipswich's best chance of the half.
The Reds made a change at the break as Brek Shea was suffering from a stomach bug and had to be replaced by Tomasz Cywka.
Jay Tabb almost got in behind Ramage but the centre-half recovered to ease the ball to safety after the former Brentford man looked to go through on goal just minutes into the second half.
Frank Nouble was replaced by Paul Anderson on the wing for Town's first change, which came just after Jack Hunt had taken a real whack on the ankle from Stephen Hunt.
Hunt put a peach of a cross in for Berra after Ipswich built up the play well down the left but he volleyed wide from 12 yards on 64 minutes.
Luke Steele made a brilliant double save from Murphy and Anderson on 66 minutes as McCarthy's men began to show why they are so close to the play-offs. Murphy's 20-yarder was parried to the side by Steele and the rebound from Anderson was well blocked against by Steele.
Jack Hunt was replaced by Martin Woods, and O'Brien was expected to fill in at right-back on 73 minutes. Green replaced Tabb for the visitors.
A free kick on the left-corner of the box for the Reds presented Tomasz Cywka with the chance to shoot and the Pole didn't waste his chance. His vicious effort took a slight deflection on the way through but there was nothing to be taken away from how true Cywka connected with his strike on 74 minutes.
Liam Lawrence was Barnsley's third and final change as he came on for Nick Proschwitz with 13 left on the clock.
The visitors pulled one back through Berra on 81 minutes as a corner was cleared off the line by O'Brien but only into Berra's path who thumped home.
From the restart Tabb came close to bagging a leveller as Town put a raid on down the left and the midfielder was inches away with his deft touch.
A free-kick for McGoldrick wasn't wasted as he hammered into the roof of the net from 20 yards via a slight deflection on 84 minutes.
Cranie came to the rescue with a last-ditch block just as Murphy's shot looked destined for the bottom corner.
Reds: Steele, Ramage, Kennedy, Cranie, O'Brien, Dawson, Jennings, Shea (Cywka 46), Hunt (Woods 74), O'Grady, Proschwitz (Lawrence 77).
Subs: Turner, Nyatanga, McCourt, Pedersen.
Ipswich: Gerken, Cresswell, Chambers, Smith, Berra, Skuse (Green 74), Murphy, McGoldrick, Hunt, Tabb, Nouble (Anderson 63) .
Subs: Loach, Edwards, Wordsworth, Mings, Richardson.
Referee: Darren Bond
Assistant Referees: Peter Gooch and James Wilson
Fourth Official: Graham Salisbury.
Attendance: 9929 (817 Ipswich)
Man of the Match, sponsored by Napoleon's: Dale Jennings