Both are acceptable, but you would use them in different contexts. The preposition “on” makes it an adverbial phrase of time:
We arrived on Thursday.
We arrived on Christmas.
We arrived on the last day.
If you use “the last day” as a subject or an object of a verb, you wouldn’t use the preposition:
The last day will be challenging.
We planned the last day carefully.
You might drop the preposition in informal situations where it’s obviously being used to mark an adverbial phrase and it wouldn’t be confusing to remove it:
We saw him (on) the last day.
In your example, I would use “on” because it’s next to another adverbial phrase (“in time”). “In time the last day” would be a little unclear to me, but maybe others wouldn’t have a problem.