How did the word last come to mean both the final time ("this is the last time I do this") and the previous time "the last time I did this it was a big fiasco, that's why I'm doing it over".

This doesn't make sense to me. We have the same thing in French with the same word - dernière/dernier