Aberdeen manager Derek McInnes was thrilled to see his players stop their losing streak as they booked a Betfred Cup quarter-final tie away to Hearts by eliminating Dundee after extra-time at Dens Park.
Sam Cosgrove's extra-time winner earned the visitors a 2-1 win to end a run of three straight defeats in all competitions.
The Dons needed a stoppage-time equaliser from Andrew Considine to force the extra 30 minutes, though, after Danny Johnson's 43rd-minute penalty had put Dundee in front.
McInnes said: "I need to applaud Dundee. I watched them last Saturday and not only did we have to deal with a team motivated, playing with confidence and who had prepared all week, they were certainly ready for it.
"We turned up for the game and made the players aware of how difficult it would be, especially after playing with 10 men for so long on Thursday (in their Europa League loss to Rijeka).
"We were not brilliant. It was all about digging deep and getting the result. Two weeks ago we left Pittodrie after beating Hearts 3-2 and everyone was euphoric.
"This was the best team we had had in a while and we cannot go as high as that to as low as we were.
"If Andy (Consideine) has conceded a penalty he has certainly made up for it.
"It was a real dagger to the hearts of the Dundee players late on and we looked more equipped to get the second goal and, once we got it, we managed to get over the line without too much fuss.
"Dundee gave us a right game and made it difficult for us. Cup games are all about finding a way to win and my players deserve so much praise for that.
"A lot of people would have taken pleasure in seeing us go out of the cup and I have a lot of pleasure in seeing my team go through.
"I know we can improve, be far more slicker and more technical, and I know we'll have more energy in our legs. There are certain games where you need grit and determination and we had that."
Dundee manager James McPake admitted he was "devastated" by the late heartbreak.
McPake said: "I'm proud, but I expect my team to be like that. That type of performance has been coming for a while, but I'm devastated for them and the fans.
"When you are a player and you put that much effort in, losing is hard. Over the 90 minutes we deserved to win the game of football.
"My players were excellent and deserved to win and had we got the second goal we would have won the game."