I have always thought like the one below needs not tense-change. Or is it?

I was going nowhere here, so I decided to think of what was best for me first and this time it meant leaving.

I think the first underlined part is a to-infinitive and am wondering why it has to be 'what was best' and not 'what is best'. Can I use 'what is best' there?
A side question: Could I have written 'this time it means leaving'? What is the difference. What bothers me is the fact that the words 'this time' is there.

I was feeling ill, so I decided to head home. -- I think the part underlined is a to-infinitive.
Yes. to think is a to infinitive, and to head is a to infinitive.
The tenses match. All are past:
was going, decided, was best, it meant
It is quite usual to use the same tense throughout a sentence.
this time can be used to mean a time in the past. (So can now.) It means on this occasion within the story I'm telling -- at this point in the story.
Thank you. So, what I have vaguely been known is incorrect: that a to-infinitive shouldn't (might??) not change?

I decided to think what was best for me and decided to leave. -- Good, I think the tenses are all in the past.
But how about this?

I decided to think what is best for me and decided to leave.