This happened on my ATL-MSP flight last month. A guy got on board sat down, then when the FA's did the "welcome to flight..." announcement he got up and said he was supposed to be on the flight to Washington.
This was a typical one gate, one jetway, one airplane situation. So like the OP asked, how does this happen with the boarding pass scanners?