He was India captain Rohit Sharma's opening partner in the home T20 series against Afghanistan earlier this year but his place looked under threat as he struggled for runs in the IPL
Chasing a modest 263 for victory, Afghanistan's opening batsmen Mohammad Shahzad and Hazratullah Zazai got them off to a blistering start before Shahidi took charge to help them cross the finish line in the final over.
Pakistan batsman Babar Azam, who shone in their 4-0 series defeat by England this month, continued his excellent form with the bat ahead of the World Cup scoring 112 off 108 balls but his team were restricted to a below-par 262 in 47.5 overs.
Afghanistan spinners Mohammad Nabi (3-46) and Rashid Khan (2-27) then choked the Pakistan batsmen to lay the foundation for a famous win while pacer Dawlat Zadran claimed two wickets, including that of the dangerous Azam.