The Oak Leafers raced into a four-point lead but James Smith scored a sixth-minute goal to get Cavan back into it.
Cavan lost Smith to a black card as Derry led 0-14 to 1-7 at the interval, but Philip Rogers punched a goal to narrow the gap soon after.
Ben McCarron scrambled home a vital goal eight minutes from time to guide his side towards the winning line.
The Breffni boys displayed grit and determination to stage a number of comebacks and keep themselves in the game right up until that crucial goal.
Derry got off to a flyer, and superb scores from Lorcan McWilliams and Conleth McShane helped them go four points clear, Smith then finding the net for Cavan.
However, the Oak Leafers were able to exploit gaps in the Breffni defence to pick off scores through McWilliams and McCarron to go 0-6 to 1-1 ahead by the eighth minute.
And they shot another volley of points, the best of them from Declan Cassidy, to make it 0-11 to 1-2.
Cavan lost key midfielder Smith to a black card, but finished the half strongly with scores from Philip Rogers and Tiernan Reilly, but Derry led by four at the break.
Rogers found the goal two minutes into the second half, and the Breffni lads refused to lie down.
But Lorcan McWilliams added a couple more to his tally, and in the 52nd minute, McCarron found the net.
Derry: O Hartin; O McGill, C McCluskey, S McKeever; S McErlain, D Rafferty, C McShane (0-1); P McGrogan (0-1), O McWilliams (0-1, f); P Quigg (0-4, 1f), R Mullan, D Cassidy (0-3); B McCarron (1-3), L McWilliams (0-6, 3f), M McGrogan.
Subs: T McHugh (0-1) for M McGrogan (h-t), C Brown for Mullan (h-t), A Doherty (0-1) for McGill (38), M Bradley for Cassidy (47), F Mortimer (0-1) for Quigg (55), C Murphy for McCarron (58)
Cavan: G O'Rourke; E Fortune, P Meade, K Brady; D Cusack, C Timoney, K Hendrick; R Patterson, J Smith (1-0); O Kiernan, C Madden (0-3), P Rogers (1-2); O Pierson (0-4, 2f), P Lynch (0-1), S Keogan.
Subs: J Cooke (0-1) for Meade (21), T Reilly (0-1) for Smith (BC 23), P Nulty for Hendrick (38), N McCabe for Keogan (49), C Lynch for Kiernan (50)
Referee: M McNally (Monaghan).
Derry lifted their second Ulster MFC title in three seasons with a high-scoring 1-22 to 2-12 win over Cavan.