Armagh crashed out of the Ulster Minor Football Championship after an injury-time score from substitute Brian O'Connell granted Cavan victory.
The winning score was a contentious one as it arrived in the fourth minute of extra time when only three had been allocated by referee Ian Molloy.
Armagh's Shea Heffron also appeared to be fouled in the build-up, which left a sour taste in the mouths of Orchard fans.
The sides were evenly matched throughout and it appeared to be heading for extra-time before O'Connell's injury-time winner. Cavan got off to the better start as Pierce Smith fired over the first point on three minutes. The sides exchanged scores through Joseph McElroy and Ryan Connolly.
On 10 minutes, Armagh scored the game's only goal as the pacey James McDade ran in behind the Cavan rearguard before squaring the ball to McElroy who tapped in from close range.
Cathal McKenna added another point for Armagh but it proved to be their last score for 16 minutes. Cavan assumed control and points from Liam Gallagan, Connolly (2) and Ben Kiernan put the Breffni men into a one point lead.
The Orchard County eventually stirred back into life and points from Cathal McKenna and Conor Martin gave them a narrow 1-5 to 0-7 lead at half-time.
Cavan levelled four minutes into the second half through Ben Kiernan's converted free.
Ruairi Loughran's point put Armagh back in front but three points in a row from Kiernan, Connolly and Smith put Cavan ahead with 13 minutes to play.
Eoghan Burns was introduced and he made his mark by pointing twice for Armagh in the dying stages, the first from play and the second from the dead ball.
Cavan though refused to relent and captain Conor Hayes ensured that the sides were level as the game headed towards injury time.
Brian O'Connell came off the bench in the first minute of injury time and his only involvement came with what proved to be the last action of the game.
A Cavan free was launched in towards the small square and despite the fact that Armagh's Shea Heffron appeared to be held, referee Molloy let play continue.
The ball broke to O'Connell at the back post and he fisted over to give Cavan victory and a place in the Ulster Minor Football Championship quarter-finals where they will now face Fermanagh.
ARMAGH: C Rafferty; C Connolly, S Heffron, P Campbell; J Cosgrove, M Finnegan, C McNicholl; A McKay, B Boylan; C McKenna (0-3), R Loughran (0-1), G McCabe; C Martin (0-1), J McElroy (1-2, 2f), J McDade. Subs: E Burns (0-2,1f) for C McNicholl (half-time) C McConville for R Loughran (50), C McCullagh for C Martin (54), D McKenna for M Finnegan (55)
CAVAN: S McDermott; B Fortune, B Kelly, D Monahan; C Bradley, M Magee, N Clerkin; K Monahan, G McGovern; P Smith (0-2), R Connolly (0-5, 2f), B Kiernan (0-3, 2f); T Hayes (0-1), L Galligan (0-1), D Brady. Subs: S McKeogh for D Monahan (half-time) D Gannon for P Smith (47), H O'Neill for D Brady (53) B O'Connell (0-1) for S McKeogh (61).
Referee: Ian Molloy (Donegal).