A handy way to look up flight numbers and destinations is an airline's timetable. Here is the one published by Air Canada:
https://services.aircanada.com/portal/rest/timetable/pdf/ac-...
So, flight 8742 is from Montreal to Bathurst. That matches up. The boarding pass confirms that. And flight 874 is indeed a flight from Montreal to Frankfurt, as your post explains.
If I had to guess, your flight was a short hop from Montreal to Bathurst to pick up more passengers and possibly fuel/cargo on the way to Frankfurt. Your boarding pass says 8742 since that's the first leg of the trip that you boarded in Montreal.
Does any of this match up? Did you change planes in Bathurst?