Cameron McJannet opened the scoring in the first half with a bullet header.
Will Patching’s superb free-kick doubled Derry’s advantage at the end of a scrappy second half.
However, it was a nervy finish as Filip Mihaljevic won and converted a penalty in the 91st minute.
The Candystripes held on for their sixth consecutive victory while Harps remain ninth.
It means stay six points clear at the top of the League of Ireland table.
Harps opened in typically lively fashion with a decent run and cross from Ethan Boyle headed towards goal by Yoyo Mahdy, only for Brian Maher in the Derry goal to gather on nine minutes.
Ruaidhrí Higgins’ side, although not shying from the helter-skelter, aimed to slow the pace of the game and were soon testing Mark Anthony McGinley, the Harps goalkeeper. Danny Lafferty, in particular, was getting on the end of things.
Firstly he met a cross from Ronan Boyce to arch a header just over and then, on 23 minutes, forced the Harps netminder to tip a shot over the crossbar.
Derry opened the scoring from the corner that followed, with McJannett meeting Brandon Kavanagh’s delivery plumb-on to bury the header.
Harps created a half-chance in their first meaningful break in search for an equaliser, with Boyle again doing well down the right only for Mahdy to fail to keep his shot down. Derry continued to push, with Jamie McGonigle just off target after a neat turn two minutes before the half-time break, which soon followed with the visitors 1-0 up.
Six minutes into the second half, Shane McEleney, who played for Harps as recently as last season, glanced a backwards header inches wide from another devilish Kavanagh delivery.
Mattie Smith was released down the channel by Boyce and from an awkward angle again tested McGinley.
Then, from the opposite side, with an old -fashioned toe-poke, Smith made McGinley go full-stretch to palm away a 65th-minute shot. But without a second goal, the longer the shadows got in the Ballybofey sunshine, the more it seemed Derry weren’t sure whether to stick or twist.
Although Maher wasn’t having one of his busiest evenings, at one down Harps were never out of the running and when Barry McNamee clipped in a dinking ball into the penalty area, Dave Webster was unfortunate to see his inventive back-header hit the crossbar.
Six minutes from time, McNamee drove a shot into a clutter of bodies in the penalty area and the vital block was from a candy-striped shirt.
However, Patching’s free-kick seemed to clip McNamee to make it two and although Mihaljevic’s penalty raised the volume with time almost up, it was the away fans who left singing in the sunshine.
Finn Harps: Mark Anthony McGinley; Ethan Boyle, Conor Tourish, Dave Webster, Rob Slevin; Elie Nzeyi, Bastien Hery (Filip Mihaljevic 57); Eric McWoods (Mark Timlin 80), Barry McNamee; Yoyo Mahdy (Luke Rudden 67).
Derry City: Brian Maher; Shane McEleney, Eoin Toal, Cameron McJannett (Ciaran Coll 90); Ronan Coyce, Cameron Dummigan, Will Patching, Danny Lafferty; Brandon Kavanagh (James Akintunde 76); Matty Smith (Evan McLaughlin 90), Jamie McGonigle (Joe Thomson 76).
Referee: John McLoughlin.
Tags: