India captain Virat Kohli made Dawid Malan pay for dropping him twice with a superb maiden Test century in England as the tourists bounced back in the series opener at Edgbaston on Thursday.
India were in danger of conceding a first-innings lead of more than a hundred runs at 182 for eight.
But Kohli's superb 149 took India to 274 all out, just 13 runs adrift of England's 287.
Then with what became the last ball of the second day's play, off-spinner Ravichandran Ashwin bowled Alastair Cook for a duck with a brilliant delivery that drew the batsman forward, pitched on middle stump and turned to hit the left-hander's off pole.
It was the second time in the match that Ashwin had dismissed Cook, England's all-time leading Test run-scorer, in such a manner.
England were nine for one at the close, a lead of 22 runs.
But it might have been different story had not Malan dropped Kohli in the slips off James Anderson and Ben Stokes when the star batsman had made 21 and 51.
It looked as if the day might belong to Sam Curran when the 20-year-old Surrey left-arm swing bowler, in just his second match at this level, removed India's top order with a spell of three for eight in eight balls en route to Test-best figures of four for 74 in 17 overs.
Kohli was on 97 when No 11 Umesh Yadav came in but the tailender kept his wicket intact.
A late cut four off Stokes, his 14th boundary in 172 balls, saw Kohli to his 22nd Test hundred.
He then struck several stylish attacking shots, including a classic cover-drive for four off Stokes and a lofted six off leg-spinner Adil Rashid.
And when he hit two off Rashid to go to 135, it meant Kohli had made more runs in the one innings than he did in the whole of his maiden Test series in England four years ago when he was restricted to 134 runs in five matches at a meagre average of 13.4.
Kohli was last man out when he cut Rashid straight to Stuart Broad at backward point.
He batted for nearly five hours and faced 225 balls, including 22 fours and a six.
Kohli farmed the strike brilliantly during a last-wicket stand of 57 with Yadav, who faced 16 balls for his unbeaten one.
Earlier, Curran's wicket-taking burst began when Murali Vijay was lbw on review for 20.
Two balls later Curran dismissed KL Rahul for four via an ugly flat-bat drag-on.
Left-hander Shikhar Dhawan (26) nicked a well-directed Curran outswinger to Malan at second slip.
India, 76 for three at lunch, lost their next two wickets on 100 with Ajinkya Rahane (15) caught in the slips off Stokes before the all-rounder bowled Dinesh Karthik for a duck.
Kohli nicked Anderson only for Malan to drop a low catch at second slip.
That was the last delivery of the over and the next ball saw all-rounder Hardik Pandya missed on nought when Cook dropped a routine first-slip chance off Stokes.
But Curran returned to have Pandya lbw for 22 with an inswinging yorker.
Soon after completing a 100-ball fifty with his ninth four, Kohli was missed again by Malan, this time off Stokes.
SCORES IN BRIEF
ENGLAND: First innings 287 and second innings 9 for one (Cook 0, Jennings 5 not out; Ashwin 1-5)
INDIA: First innings 274 (Vijay 20, Dhawan 26, Kohli 149, Pandya 22; Anderson 2-41, Curran 4-74, Rashid 2-31, Stokes 2-73)