Test cricket is not about playing pretty for 50 deliveries; it is about showing guts to survive even when you are batting crappy.
As [MENTION=142162]Napa[/MENTION] pointed out, Imam's innings was more significant than Babar and Sarfraz's. A beautiful 49 (55) and a flashy, streaky 50 (45) does not win you Test matches especially in these conditions.
Babar and Sarfraz's innings did nothing for the team in the grand scheme of things. They did not score enough runs to cut down South Africa's lead significantly, and they did not spent enough time at the crease to make South Africa force the pace in the second innings.
They threw their wickets away in the 43rd and 44th overs when the ball was getting old and scoring runs was becoming easy, and had either of the gritted it out for over a hundred deliveries like Imam, we would have been in a significantly stronger position.
Imam's innings was not one for the highlight reels, but he survived the first session against the new ball and played 105 deliveries when the team was reduced to 6/2 with a nightwatchman at the crease.
In his brief international career so far, with less than 30 games and less than 15 months of experience, Imam has shown signs of having grit and a cool head. His output has been reasonable so far, and most of his best performances have come when other batsmen have gone bonkers, e.g. the Ireland chase, the Asia Cup, this innings etc.
During this whole period, he also has had to deal with relentless criticism and abuse on social media for nepotism, something that his very well aware of. A lesser character could have had his confidence shattered, but he is prepared to fight and prove people wrong.
Inzamam may have picked him because he is his nephew, but the boy has heart and wants to make a name for himself and not just be a legend's nephew.
The way people go after him is as if he is blocking the path of the Cooks and Warners in domestic cricket. The latest saviour in the opening department these days is that Abid Ali guy. A 32 year old going through the last purple patch of his career, who would be a spent force by the time he finds his feet in international cricket.
For a country with deplorable batting resources, Imam has done enough to keep his place in the team. He is here to stay and people need to accept the reality.
Regarding that innings (43), I would have completely agreed had it been a proper innings - 43 by opener in 3 hours is gold. But, have really watched that innings? One of the ugliest innings by an opener, which was mostly built on luck rather than skill. He was dropped, poked & missed countless times, missed line for close LBW shouts few times, and most of his runs came from edges. Today, he was lucky to survive 100+ balls, another day he will be out 4-5 times in those 100 balls. I have seen openers making less mistake in an entire series & yet got drooped.