As long as the next leg begins BEFORE the 2.5 hours expire then that full leg counts as part of the trip. In your first example there would be no problems, but the second example would end up being two full-fare trips.
This issue is worthy of debate, but the transfer window has to end at some...