Michael Gardyne scored the only goal of the first half when he tucked away a Filip Kiss pass from close range.
Dundee levelled mid-way through the second half when substitute David Clarkson scooped a Martin Boyle cross in at the near post, but in time added on, Maatsen hammered home the winner after Joe Cardle and Liam Boyce linked up in the build up.
Both sides looked up for it after their cup defeats in midweek, and Kiss had a great chance to put the home side ahead in the 10th minute when he latched on to a knock down from Yoann Arquin but his shot across goal finished up wide of the far post.
County continued to press and Arquin was just about to pull the trigger from 12 yards when Paul McGinn slid in to make a telling tackle.
It just looked a matter of time before County would take the lead and Kiss had another chance in the 21st minute when Gardyne slipped the ball through to him but he was closed down by Dundee goalkeeper Kyle Letheren.
The pressure paid off six minutes later when Arquin flicked the ball on for Kiss, whose ball across the face of the goal was knocked in at the far post by Gardyne.
County were well on top and Gardyne cut in from the right in the next meaningful attack but his shot was deflected behind for a corner.
In a rare attack Luka Tankulic fired a long distance shot which Mark Brown, in the County goal did well to smother.
It was mostly County, though, and play had to be stopped at the other end when a rocket shot from Rocco Quinn pole-axed James McAlister, with the visibly shaken defender eventually going off to be replaced by Cameron Kerr.
County had another chance before the break when Gardyne passed through for Kiss, who shot just wide of Letheren’s left-hand post.
Dundee made a substitution at half-time with Craig Wighton replacing Tankulic in a straight swap up front.
But it was County who had the first shot on target in the 48th minute when Kiss forced a save from Letheren who gathered the ball at the second attempt.
But just when it looked as if County were getting on top again Dundee struck.
Martin Boyle raced up the right wing and his cross into the box was hooked into the net by substitute David Clarkson.
County won a free kick in a dangerous position in the 72nd minute but Richard Brittain’s free-kick flew well over.
Both teams were going all out for a winner and Greg Stewart forced a save from Brown in the dying minutes.
But County hit the winner in deep in injury-time when Cardle’s ball into the box was knocked on by Boyce and fellow substitute Maatsen smashed the ball into the roof of the net to send the home crowd wild.