The expression "to have the last laugh" means to come out on top in a dispute or contest eventually, even if it may at first not seem so. This is particularly so if the person was laughed at before, e.g.
All the courtiers ridiculed the stranger who, when any wish would have been granted to him, only asked for a chessboard full of rice, but he had the last laugh when it turned out all the king's granaries did not hold enough grains ...
But it is also often used when someone's fortunes simply turn for the better, although I think there should always be some form of conflict, e.g.
The rebellious generals seized two dozen of the emperor's ships, yet he had the last laugh, because the aging vessels with their discontented crews proved a disastrous addition to their fleet ...
How can we say this in Latin?