The 33-year-old former Swansea and Wigan striker, signed until the end of the season on Monday following his release from Ipswich, came off the bench in the 62nd minute and slammed home an emphatic 12-yard finish less than 90 seconds later.
Barnsley, who took the lead through striker Chris Dagnall's fourth goal in as many matches 11 minutes earlier, were good value for their two-goal advantage and comfortably held on to secure their fourth win in six matches under manager David Flitcroft.
The Tykes, who began the game second from bottom, were aware they needed a victory to boost their survival hopes and duly turned in an impressive performance.
Millwall's best chance fell to forward John Marquis, who failed to control a skidding ball played over the top that left him one-on-one with Tykes goalkeeper Luke Steele shortly after Scotland's goal.
Kenny Jackett's side have now won only one of their last seven league games and passed up the chance to move within three points of the play-offs. They were a clear second best on the night and rarely looked like promotion contenders.
Defenders Stephen Foster and John Stones, plus winger Jim O'Brien returned for Barnsley, with new signing Scotland on the bench, as was Millwall's latest acquisition, Rob Hulse, signed on loan from QPR until the end of the season.
Millwall were unchanged from the side that started in last Friday's FA Cup win over Aston Villa.
Barnsley striker Dagnall pulled an early effort wide, but Millwall should have taken the lead when striker Andy Keogh met James Henry's fine cross, only for the Republic of Ireland international to side-foot his volley over the bar.
Home midfielder Kelvin Etuhu did his best to lift the crowd with a driving run and shot that skidded wide and Marlon Harewood's angled effort drifted tamely wide as Barnsley looked the more likely to carve out a genuine scoring chance.
O'Brien raced into a gap and fired in a low shot that almost spun out of Millwall goalkeeper David Forde's clutches at the start of the second half before Barnsley took the lead they deserved in the 56th minute.
Harewood slipped the ball into the area and Dagnall raced on, stayed strong under the covering defender's challenge and dinked a clever finish over Forde's sprawling dive.
Jackett sent on Hulse for his debut, Shane Lowry and Martyn Woolford in the 63rd minute, while Flitcroft responded by sending on Scotland soon after and was almost instantly rewarded.
Not quite 90 seconds later Barnsley's David Perkins cut through to the edge of the area and played in Scotland, whose thumping left-footed finish brought most in a crowd of 7,844 to their feet.
Lions striker Marquis was inches away from connecting with a long ball over the top when he would surely have reduced the deficit had he controlled it as Millwall tried to respond, but the home side held on without any further scare for a third straight home win.
- Sports & Recreation
- Chris Dagnall