Barnsley led 2-0 at the interval thanks to a Craig Davies penalty and Ricardo Vaz Te’s diving header.
But Ipswich stunned Oakwell in the second half, with Andrews scoring with a volley and then a near post header.
Further goals came from a Danny Collins header, a clinical Michael Chopra finish and a Jason Scotland effort before Davies added a consolation with a fine free-kick.
Barnsley took the lead from the spot in the 13th minute, after Jacob Butterfield was given time and space to pick out Danny Drinkwater’s run and he was brought down by David Stockdale.
Davies stepped up to send the goalkeeper the wrong way.
Barnsley should have gone further ahead eight minutes before the break when Davies robbed Ibrahima Sonko to go clean through.
His shot was saved by Stockdale but with the ball seemingly certain to bounce into the net, Sonko got the slightest touch on the ball and it bounced off the post, with the onrushing Davies inches away from a telling touch into the empty net.
But Barnsley did double the lead a minute later through Vaz Te, the Portuguese striker rushing to the near post to meet a Butterfield corner with a diving header, the ball going in off a post.
Ipswich got back into the game in the first 20 seconds of the second half, when a Daryl Murphy cross was headed away by Bobby Hassell, but the clearance only went as far as Andrews on the edge of the area and he unleashed an unstoppable volley into the bottom corner of the net.
And the Tractor Boys were level just two minutes later, Andrews getting on the end of an Aaron Cresswell cross to power a header home.
Ipswich almost completed the turnaround midway through the second half, when Scotland’s fierce 20-yard drive was parried by Luke Steele, but Chopra was offside when slotting home.
But they did complete a remarkable comeback a minute later, Collins rising highest to head in a Lee Martin corner.
They went further ahead a minute after the third goal, Scotland picking up the loose ball and passing to Lee Bowyer, whose neat first time ball found Chopra. He buried his effort in off a post.
Ipswich added a fifth after 82 minutes as Cresswell again produced an inviting cross which an unmarked Scotland was able to slot into the corner.
Davies added a consolation in the dying minutes by curling in a wonderful free-kick from 25 yards after sub Nile Ranger was fouled.