Barnsley survived two Albert Adomah goals in the last ten minutes as they secured their first victory since August.
Paddy McCourt put them ahead on 26 minutes when he beat six visiting defenders inside the box before netting to seal a wonderful goal. He was taken on off instantly for Jim O'Brien who fired in a shot on 40 minutes which took a deflection off team-mate Chris O'Grady before trickling in for 2-0.
It got better three minutes later then Marcus Pedersen was brought down in the 44th minute and O'Grady score his second.
Boro went into the break 3-0 down but could have had several goals themselves with Lukas Jutkiewicz missing four clear cut chances including two seconds before the first two Reds goals.
Mustapha Carayol hit the post for Boro before setting up Adomah to net with a fine volley on 82 minutes before the same player headed in for 3-2 on 84 after very poor marking by Barnsley.
Adomah missed out on a hat-trick when he curled a free-kick just over then George Friend had a header from a corner deflected wide.