This expression refers to the finishing touch of a cherry on top of a cake that gives it the perfect decoration. Use this expression when a detail puts the finishing touch to a situation or a project.
Example:
“En plus de gagner le tournoi de Wimbledon, Andy Murray se qualifie pour le Masters. C’est la cerise sur le gâteau !”
(“In addition to winning the Wimbledon tournament, Andy Murray qualifies for the Masters. It’s the cherry on the cake!”).
It can also be used in an ironic tone, meaning in this case that one last detail completely deteriorates a situation that was already going badly.