Yendrick Ruiz scored a late brace for Jafet Soto's side, who sit fifth and a distant 12 points behind league leaders Alajuelense.
Perez Zeledon have suffered four losses in their past five league matches to be in eighth.
Francisco Calvo's header and Gabriel Gomez's neat finish had Herediano ahead 2-0 by the 62nd minute.
Alejandro Alpizar pulled a goal back for the visitors before Ruiz had an impact with his brace.
Jose Sanchez completed the scoring in additional time as he lobbed the onrushing goalkeeper to make it 5-1.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.