"I eat the last cake."
Translation:Ithim an cáca deireanach.
deireanach is an adjective, and adjectives usually go after the noun in Irish ("big cake" - cáca mór, "blue cake" - cáca gorm, "sweet cake" - cáca milis, "last cake" - cáca deireanach). An goes before the noun (an cáca), not the adjective.
In the case of "I eat the cake last (after I eat everything else)", "last" is an adverb, not an adjective. The adverbial form of deireanach is ar deireadh - ithim an cáca ar deireadh.