Gary Roberts put the hosts ahead after just two minutes, finishing from six yards, and George O'Callaghan's 25-yard drive made it 2-0 at half-time.
But Danny Haynes struck from 12 yards before Francis Jeffers and Jonathan Walters added late goals.
Barnsley boss Simon Davey:
"It was a bad day at the office but there is no doubt in my mind that we will secure enough points to stay in this division.
"We had to gamble to try to win the game so we had three up front. Now we must focus on our task.
"We have five games left and know what we have got to do. This was a setback, a cup final that we have lost."
Ipswich: Price, Wilnis, De Vos, Bruce, Wright, Peters, Garvan, O'Callaghan, Roberts (Haynes 71), Walters, Lee (Jeffers 46).
Subs Not Used: Supple, Williams, Miller.
Booked: Garvan, De Vos.
Goals: Roberts 2, O'Callaghan 43, Haynes 82, Jeffers 86, Walters 90.
Barnsley: Colgan, Hassell, Paul Reid (Kay 46), Nyatanga, Heckingbottom (Rajczi 75), Jones, Howard, Togwell, Hayes (Nardiello 64), Kyel Reid, Ferenczi.
Subs Not Used: Letheren, McCann.
Booked: Heckingbottom, Hassell, Jones, Ferenczi, Rajczi.
Goals: Nardiello 79.
Ref: T Bates (Staffordshire).