Last laugh

The person who has the last laugh ends up with the the advantage in a situation after some setbacks.