Manchester City 2 Sheffield Wednesday 1: Milner's double rescues City
A famous upset appeared on the cards when Atdhe Nuhiu's 15th-minute opener put Wednesday ahead in the third-round tie at the Etihad Stadium.
However, the Championship side's brave resistance was ended when birthday boy Milner finished a well-worked move in the 66th minute.
And the England international completed the turnaround for the Premier League champions in the closing stages when he turned in David Silva's low cross from close range.
The result was just reward for City's relentless second-half pressure, but cruel on a Wednesday side who battled valiantly and will consider themselves unfortunate to have missed out on a replay.
But visiting head coach Stuart Gray - whose side sit 10th in the Championship - can take heart from an improved showing from their last visit to the Etihad, which resulted in a 7-0 drubbing.
City dictated the tempo in the early stages and Jesus Navas fired an early warning shot with a half-volley that sailed over the crossbar.
However, it was Wednesday who took a surprise early lead.
Kieran Lee sent Stevie May free down the right flank and the Scotland international squared to strike partner Nuhiu, who confidently slotted home a first-time shot from the edge of the penalty area.
City pressed in search of an equaliser, but they were regularly denied by a stubborn Wednesday defence.
The hosts went close to a leveller in the 26th minute when Frank Lampard - who scored twice in the League Cup victory over Wednesday - placed a shot narrowly wide of the left-hand post from 20 yards with Chris Kirkland rooted to the spot.
Wednesday appeared content to protect their lead and utilise the counter-attack and May curled a rare shot wide from distance.
City ended the half with a tentative penalty claim when Milner was nudged to ground by Liam Palmer, but referee Michael Oliver was uninterested.
The home side initially continued to struggled after the break, although they did start to threaten with a flurry of dangerous balls into the area that failed to yield a positive outcome.
Manuel Pellegrini was forced to chance his arm on the hour with the introduction of Samir Nasri and David Silva from the bench.
And the changes proved pivotal as City restored parity midway through the second half.
Nasri played the ball into Silva, who in turn flicked an exquisite pass into the path of Milner on the left of the area and his drilled shot went through the legs of Kirkland.
Buoyed by the leveller and with Wednesday dropping deeper, City pressed in search of a winner with Yaya Toure shooting straight at Kirkland and a last-ditch tackle from Tom Lees denying Milner a second.
Wednesday were having to withstand increasing pressure and Kirkland produced a superb one-handed save to deny Silva in the 90th minute.
However, it would not prove enough as soon after Silva once more provided an assist with a cross from the right that Milner poked home, with Wednesday's appeals for offside falling on deaf ears.