I think it's 2am (without checking FRPP) but there are easements e.g. you can use tickets dated for the previous day on 03xx Leeds-York. (You won't get a ticket check on that train anyway IMX but I guess the barriers will still be in operation - at least I'd hope they would be to prevent undesirables getting on after a night drinking in Leeds! So, in theory, the barriers would accept tickets at that time... or perhaps not and staff have to manually let them through, I am not sure).
That applies to when you start your journey; if you have already started it then you can continue it for as long as needed (if overnight stay is required it must be resumed by 12pm the next day).