Hi ybgg
Until a few years ago, it was possible to board a train that left a station before 05:00 AM; the ticket from the previous day, valid until 05:00 AM, remained valid as long as one stayed on the same train despite the fact the ticket expired during the journey (at 05:00 AM). Thus, it was possible to board a train in Geneva at 04:59 and to travel with the expired ticket to St. Gallen provided the passenger remained on the train until St. Gallen. This rule was changed some time ago.
Nowadays, your seven25 is valid to the last stop before 05:00 AM / 07:00 AM. Therefore, you must buy a ticket from the last stop before 05:00 AM or 07:00 AM respectively.
Examples:
If you board a train on a weekeend at 06:45 while the next stop is at 07:15, you must buy a ticket from the place the train is leaving at 06:45. If you continue without an additional ticket, or intend to buy a ticket from the station where the train stops at 07:15, you are considered a passenger without valid ticket.
If the train departs in Bern at 04:30 service nonstop to Zurich, you need a ticket for the entire journey Bern-Zurich as your seven25 is not valid.
Best regards,
Roland