McSheffrey capitalised on a mistake by Sid Nelson to score his fifth goal of the season in the 17th minute.
His late replacement O'Brien, on his Iron debut, confirmed the win in second half injury-time with a low shot.
It was a seventh home league defeat of the season for the Lions, who remain in sixth place in League One.
Scunthorpe United caretaker manager Andy Dawson told BBC Radio Humberside:
Media playback is not supported on this device
"It's a massive win coming off three good victories. Our lads were coming here full of confidence but we know this is a very tough place to come and a team which are flying high in the division.
"We prepared right and we knew what they were all about and we did what we try to do day in and day out.
"It's pleasing for us that the lads are working so hard as a group, not as an eleven, not as a squad as a full group of twenty-five players.
"It's great to see them getting the rewards when we come to places like this."
Gary McSheffrey and substitute Jim O'Brien scored in each half to earn Scunthorpe their fourth successive win and dent Millwall's play-off bid.