Twice vs Two Times
This is a stylistic rule, not a rule of the English language. It's good writing advice, but violating it isn't "wrong" it's just less elegant.
Replacing "two times" with "twice" is natural and recommended; replacing "three times" with "thrice" is weird and archaic. There's no logical reason why that should be so — that's just how English is used these days.
"It only happened the last twice" sounds wrong because last is an adjective, and it needs to modify a noun (times). It cannot modify an adverb (twice).
Twice is more used than two times as shown in Ngram, but they can be both used according to the context.
twice
Just to add on, when these words are used in groups (eg. twice or thrice) try to be consistent in using words of the same type (ie. avoid "two times and thrice" and "twice and three times" in favour of "twice and thrice" and "two and three times"). There might be a weak argument of parallelism favouring "two and three times" over "twice and thrice", but linguistic examination of the etymologies of "twice" and "thrice" is probably needed.
Source: https://www.reddit.com/r/grammar/comments/1xiwxw/two_or_three_times_vs_twice_or_three_times/