Having come straight from a disastrous tour of Australia, following another very poor one of New Zealand, all Sri Lanka had aimed to do in Durban was compete.
Where in Brisbane and Canberra Sri Lanka had virtually been played out of the game by the end of the second day, they were much more tenacious at Kingsmead. At 90 for 5 in the first innings, in response to South Africa's 235, Sri Lanka were in danger of giving up a lead of around 100, but the lower order battled hard to move to within 50 runs of the opposition.
Sri Lanka also fought back with the ball in the second innings. At one stage South Africa were 295 runs ahead, with five wickets still in hand. But left-arm seamer Vishwa Fernando and left-arm spinner Lasith Embuldeniya combined to take the remaining wickets for just eight runs, to leave Sri Lanka with an imposing but not impossible target of 304 in the fourth innings.
"I said in the beginning of the match that we needed to compete every session and every hour," Dimuth Karunaratne said, following his first Test as Sri Lanka captain. "We weren't so concerned about winning or losing, but we wanted to compete with them. In Australia, we never even had a chance to win. We didn't compete. Here, we had a good first day, then we struggled to bat so well in the first session of the second day.
"It's not easy to win a game in South Africa. We're a young side, and don't have much experience. Only a few of us have traveled and played here before. But we kept coming back. We were in the game. On the last day we also had a good partnership between Kusal Perera and Dhananjaya, so we had faith. The bowlers did a really good job to stay there and support Kusal as well."
Almost unarguably, the biggest of Sri Lanka's comebacks came right at the end of the game, when No. 11 Vishwa joined Kusal Perera at the crease with 78 runs still to get - South Africa needing only the one wicket. Through a mix of good fortune, determination, and skill on the part of Perera, the pair saw Sri Lanka home, in the process breaking the record for the highest last-wicket stand in a successful chase.
"We had belief that Kusal could do it, but the other thing was we needed someone to support him," Karunaratne said. "When (No. 10) Kasun Rajitha got out, we knew we needed a few shots from Kusal. We never thought that we had the game in hand. But the dressing room thought that Kusal could do it, and we were excited when Vishwa was batting. I think Vishwa did a really good job. There were a lot of nerves."
The Kingsmead victory comes as a substantial relief for Sri Lanka, who had not won a single match, in any format, since late October. With selectors making wholesale changes to the side, and with coaching staff also being replaced, more than one player had privately suggested the Sri Lanka dressing room had been a tense environment over the past few weeks. A famous win, however, will help everyone loosen up, Karunaratne hoped.
"The main thing is we need to relax. The boys need to enjoy themselves. When that happens, when you go out to the middle, you can perform well. For me, when I enjoy life, I have a clear mind when I go to bat. That's what I told my teammates as well. The next match is on the 21st. We will practice and work hard, but at the same time we will enjoy and celebrate this win."