The substitute's goal after an hour on Monday night added to Nauris Bulvitis' close-range effort in the 42nd minute which put the hosts in the driving seat at Tulloch Caledonian Stadium.
Motherwell arguably were the better side on the night but failed to capitalise on any of their attacking moves with Caley goalkeeper Ryan Esson thwarting Craig Brown's men on several occasions.
The reward for Inverness is a trip to Kilmarnock in the next round.
Motherwell's Tom Hateley squandered the first good opportunity of the game in the 26th minute when he smacked a 25-yard free-kick into the Inverness wall, after Jim O'Brien was tripped by Bulvitis.
Motherwell defender Mark Reynolds blocked Dani Sanchez's effort in the 31st minute after Lee Cox played him in and moments later the Spaniard steered a shot wide when played in by Richie Foran.
The visitors responded well and their joint top-scorer Lukas Jutkiewicz had the first shot on target in the 33rd minute, but Esson made a low, diving save and three minutes later the goalkeeper stood up well to block the on-loan Everton attacker.
Jutkiewicz then shot over from 25 yards in the 40th minute, before Inverness manager Terry Butcher brought on Imrie for Hayes.
Imrie made an immediate impact when his corner in the 42nd minute was headed down into the six-yard box by Ross Tokely, where Adam Rooney saw his volley rebound off Reynolds on the goal-line to Bulvitis, who found the net to put the hosts in front at the interval.
Well boss Craig Brown introduced Jamie Murphy for Steven Saunders at the break in a substitution with an attacking intent.
Murphy showed his potential threat moments after the restart when he played through Jutkiewicz, who was offside, and again in 49 minutes when he forced a low diving save from Esson at close range following a driving run.
Imrie headed wide from close range moments later at the back post when he connected with Foran's cross.
Bulvitis was booked for a foul on O'Brien in the 53rd minute and the Well player then had a free-kick turned away for a corner which came to nothing.
O'Brien saw yellow two minutes later when he felled Imrie, moments before Cox fired over for Inverness from 35 yards.
Imrie doubled the host's advantage in slightly odd circumstances in 61 minutes after Russell Duncan found him on the wing. The attacker, who was on the ground following a challenge, picked himself up as Inverness moved forward and his angled shot from just inside the box evaded the outstretched John Ruddy to make it 2-0 to Inverness.
Brown responded by bringing on John Sutton for Chris Humphrey.
Motherwell's Hateley was shown yellow for a foul on Imrie in 66 minutes, seconds before Butcher brought on Robert Eagle for Sanchez.
The visitors took off Giles Coke for Ross Forbes in 69 minutes.
Consistent Motherwell pressure led to Forbes driving a low free-kick into the arms of Esson after 76 minutes as the visitors tried to pull one back.
Jutkiewicz sent an effort wide from the edge of the area with a shot on the turn in the 79th minute as they continued to press, but to no avail.
Slick passing moves from the Steelmen failed to pay dividends as Inverness held on in the closing stages to ensure the Scottish First Division club progressed to the next round.