I can't reproduce this problem using the same version of SSDT as you. I do have a slightly newer Visual Studio (15.9.24), but I'd be surprised if that matters. Here's my (very minimal) setup, please let me know if I've misunderstood some part of your scenario:
CREATE SCHEMA [clr]
CREATE SCHEMA [Stats]
You can use status to set groups, and then get min and max time of each group.
If there is a serial id (PK), and it can be used to set an order, maybe you can get a better performance.
Due each intermediate status=0 belongs to two groups, I've added a new column with the time of the next row to get max(time).
with ev as