Diagrammatic perturbation theory: the contribution of triply excited states to correlation energies