Tudgay struck in injury time after Chris Wood appeared to have salvaged a point for the Lions, who had lost just once in their previous 16 matches.
Barnsley led through a first-half goal from Stephen Dawson, shortly after Millwall's Darius Henderson had missed a penalty.
To make matters worse, the hosts had defender Adam Smith sent off for a rash challenge early in the second half.
Wood tucked in his third goal in two matches, and his 11th of the season, 10 minutes from time but Tudgay had the last word as Millwall slipped out of the play-off places.
Millwall were surprisingly lacklustre for a team in such fine form, unbeaten at home in their previous seven games, and it was Barnsley who made the brighter start with two good chances falling to Tudgay in the first 10 minutes.
First Lions goalkeeper David Forde did well to tip Tudgay's shot round the post, then a mix-up in the Millwall defence saw the ball fall to Tudgay again, but this time the striker blazed his shot over the crossbar.
The hosts should have taken the lead in the 25th minute after Henderson was fouled in the area by Scott Wiseman.
But Henderson, back in the Millwall side after a spell out with a hamstring injury, blazed the spot-kick over the crossbar.
And the Lions were made to pay five minutes later when Barnsley broke at the other end through Tudgay.
The ball eventually fell to Jim O'Brien, whose shot was well saved by Forde, but Dawson was on hand to tuck away the rebound for his third goal of the season to give the visitors the lead.
Millwall attempted to hit straight back and midfielder Liam Trotter shot narrowly wide from just inside the box.
Tykes goalkeeper Luke Steele was then called into action to make saves from Henderson and Shane Lowry.
Barnsley had chances to add to their lead before half-time but Forde saved John Stones' effort and O'Brien crashed a shot into the side-netting.
Millwall's task got more difficult 10 minutes after the interval when Smith was sent off after he lunged in on David Perkins.
It looked like a 50-50 challenge but referee Trevor Kettle deemed it to be two-footed and produced a straight red card.
Barnsley sensed the chance of a rare win and Perkins drove the ball goalwards but his effort was kept out by Forde.
Perkins then crossed for Tudgay but his ambitious header from the edge of the area flew wide, before Chris Dagnall missed the target from close range and Stephen Foster fired over the top.
Barnsley were caught out 10 minutes from time when Wood latched onto Dany N'Guessan's ball over the top and coolly finished past Steele.
But all Millwall's hard work was undone when Tudgay rifled the winner past Forde in the 93rd minute.
The goal lifted the Tykes to the same points tally as Tudgay's former side Sheffield Wednesday, although they remain in the bottom three on goals scored.
- Sports & Recreation
- Darius Henderson