TT leaderboards work as follows, which I know for certain was the same in the two previous games and probably was for many before that.
If you don't currently have a time on the leaderboard and set a time where you exceed track limits this is still saved to the leaderboard. It goes in a section at the bottom of the leaderborad with other invalid lap times, but all are ranked below the slowest valid lap time. If you set a faster time but still exceeding track limits you will be higher in this section of the leaderboard.
When you set a valid lap this will go onto the leaderboard even if it was slower than your fastest invalid time, placed in order with the other valid lap time and higher than all invalid times.
Having put a valid time on the leaderboard, no further invalid lap times will be saved, no matter how fast they are. You will only move further up the leaderboard when you set a faster valid time.
I hope this makes sense?