But the seasoned Afridi sealed his side's win with two mighty hits off the next two deliveries to keep Pakistan afloat in the five-nation tournament with their second win in three matches.
India, the reigning World Cup champions, suffered their second defeat in three games and are unlikely to make the March 8 final even if they beat Afghanistan in their last match on Wednesday.
Afridi returned unbeaten on a quickfire 34 off 18 balls, studded with three sixes and two boundaries, but the victory was set up by all-rounder Mohammad Hafeez.
Hafeez picked up two wickets and then top-scored with 75, adding 87 runs for the fifth wicket with Sohaib Maqsood (38) after Pakistan were reduced to 113-4 in the 23rd over.
But both batsmen fell in successive overs - Hafeez caught in the deep off Ashwin and Maqsood was run out - to leave Pakistan on 203-6.
India grabbed three more wickets to make it 236-9 before Afridi's blitz in the company of last man Junaid Khan carried the jubilant Pakistanis home.
Afridi, a 34-year-old veteran of 377 one-dayers, said he was delighted to contribute to his side's win in a crunch match.
"Expectations were high," he said. "We all know how important this game was and I am glad I did it. It's a great occasion whenever we play against India and today was our day."
Pakistan captain Misbah-ul-Haq appeared a relieved man after Afridi's heroics.
"It was a really important win and I am happy because Pakistan played really well under pressure," he said. "We have the label of being bad chasers, but Hafeez and Maqsood did well and Afridi finished it perfectly."
India's Virat Kohli, standing in as captain for the injured Mahendra Singh Dhoni, said he was proud of the way the team responded to the challenge.
"The guys put in a good effort after a modest total," he said. "We were 20 to 30 runs short with the bat. But this game could have gone either way. We may not make it to the final, but I am proud how the bowlers fought back."
Indian leg-spinner Amit Mishra marked his first match in the tournament with two for 28 from 10 steady overs on the slow pitch.
Pakistan had unsettled India's batsmen with pace and spin after electing to field, with Saeed Ajmal claiming 3-40 and debutant fast bowler Mohammad Talha and Hafeez two each. Opener Rohit Sharma (56) and Ambati Rayudu (58) were the main contributors for India at the top of the order, before Ravindra Jadeja hit an unbeaten 52 off 49 balls towards the end.
Left-hander Jadeja, who walked in to bat in his 100th one-dayer with his team on a shaky 155-5, smashed four boundaries and two sixes to boost the total. Rayudu put on 52 for the fifth wicket with Dinesh Karthik and 59 for the sixth with Jadeja before he holed out in the deep in the 47th over.
Afghanistan, who stunned Bangladesh in their last match, take on Sri Lanka in Dhaka on Monday.
SCOREBOARD
============================================
India:
--------------------------------------------
R. Sharma c Hafeez b Talha 56
S. Dhawan lbw b Hafeez 10
V. Kohli c Akmal b Gul 5
A. Rahane c Hafeez b Talha 23
A. Rayudu c sub (Ali) b Ajmal 58
D. Karthik c Ajmal b Hafeez 23
R. Jadeja not out 52
R. Ashwin st Akmal b Ajmal 9
M. Shami c Maqsood b Ajmal 0
A. Mishra not out 1
Extras: (lb3, w5) 8
--------------------------------------------
Total: (for 8 wkts, 50 overs) 245
============================================
Fall of wickets: 1-18 (Dhawan), 2-56 (Kohli), 3-92 (Sharma), 4-103 (Rahane), 5-155 (Karthik), 6-214 (Rayudu), 7-237 (Ashwin), 8-237 (Shami)
Bowling: Hafeez 9-0-38-2, Gul 9-0-60-1 (w2), Junaid 7-0-44-0 (w1), Afridi 8-0-38-0, Talha 7-1-22-2 (w2), Ajmal 10-0-40-3
====================================
Pakistan:
------------------------------------
S. Khan b Ashwin 25
A. Shehzad c Ashwin b Mishra 42
M. Hafeez c Kumar b Ashwin 75
M. Haq run out 1
U. Akmal c Jadeja b Mishra 4
S. Maqsood run out 38
S. Afridi not out 34
U. Gul c Rahane b Kumar 12
M. Talha c Jadeja b Kumar 0
S. Ajmal b Ashwin 0
J. Khan not out 1
Extras: (lb11, w6) 17
------------------------------------
Total: (for 9 wkts, 49.4 overs) 249
====================================
Fall of wickets: 1-71 (Sharjeel), 2-93 (Shehzad), 3-96 (Misbah), 4-113 (Akmal), 5-200 (Hafeez), 6-203 (Maqsood), 7-235 (Gul), 8-236 (Talha), 9-236 (Ajmal)
Bowling: Kumar 10-0-56-2 (w3), Shami 10-0-49-0, Ashwin 9.4-0-44-3 (w1), Jadeja 10-1-61-0, Mishra 10-0-28-2 (w2)
Result: Pakistan won by one wicket
Toss: Pakistan
Umpires: Nigel Llong (ENG) and Bruce Oxenford (AUS)
TV umpire: Raveendra Wimalasiri (SRI)
Match referee: Jeff Crowe (NZL).