Porter stares in disbelief as he is shown a red card by Iain Brines
Steven Ettien fired in an extra-time winner for Hamilton as both sides ended a stormy Co-op Cup tie with 10 men.
Stephen Hughes and Chris Porter both struck the post for Motherwell before Porter was sent off on the stroke of half time for a lunge at David Elebert.
Accies forward David Graham curled in a wonderful strike only for Jamie Murphy to level matters with a sharp shot.
Ettien was on hand to bundle in the vital goal but the Accies had to hold on when Simon Mensing was sent off.
Darren Smith thought he had taken the tie to penalties when his strike hit the woodwork in the closing seconds of a dramatic evening, handled badly by referee Iain Brines.
Porter's dismissal was the major turning point as Brines reached for his yellow card on 12 occasions and flashed two reds.
Motherwell had looked the superior side before the visitors were handed the numerical advantage for a long spell.
A slick 10th-minute move ended with 'Well midfielder Hughes blasting off the inside of the post from 20 yards.
The home side came closer in the 33rd minute when Porter's header shaved the outside of the post from Keith Lasley's right-wing cross.
Murphy then ran on to David Clarkson's long pass and held off a challenge but goalkeeper Sean Murdoch stole the ball from his feet.
Brines then surprised everyone inside Fir Park by producing a red card after Porter caught Elebert with a sliding challenge as the defender cleared.
Hamilton made their extra man count in the 53rd minute when Graham collected Chris Casement's quick free-kick, turned Paul Quinn on the edge of the box and curled the ball into the bottom corner.
'Well keeper Graeme Smith pushed away Mark Corcoran's low drive at his near post and Lasley stabbed over for the home team.
Murphy levelled in the 66th minute when he drilled home from 12 yards after John Sutton laid the ball off following a free-kick into the penalty area.
James McCarthy somehow missed an open goal for the visitors, pouncing on a block from Smith only to shave the woodwork from six yards, with the keeper stranded on the deck.
Accies substitute Ettien headed inches wide and Motherwell forward David Clarkson blasted over from 12 yards as extra-time began.
But Hamilton regained the lead five minutes into the added period when Ettien collected Brian Easton's low cross 10 yards out and bundled home off the sliding challenge of Steven Hammell.
James McArthur almost killed 'Well off 90 seconds later when he turned and shot against the bar from 18 yards.
The tiring home side were struggling to get out of their half but Bob Malcolm struck the bar from a 25-yard free-kick and Murdoch produced a spectacular double stop from Clarkson after Mensing's second yellow card on 112 minutes.
'Well managed one last push and hit the frame of the goal for the fourth time when Smith lashed out from a last-minute corner before Accies booked their quarter-final place.
Motherwell manager Mark McGhee:
"I know that Chris Porter is as honest a lad as you'll get. I wish he would hurt somebody. He didn't even think he was going to get booked.
"I managed to restrain myself. I have been trying really hard to support our referees, but it was a disappointing decision.
"The referee said he has got to give it as he sees it. I said: 'Surely you have got to know the player?' I think they have got to understand the game.
"If you ask me how we lost the game, it contributed eventually, but prior to that we haven't done enough.
"It was really down to the first half when I was very disappointed with the quality. I think we needed to establish a lead."
Hamilton Accies manager Billy Reid:
"It's nice to come and beat your rivals. It could have gone either way - they hit the woodwork a few times. Everything seemed to happen out there.
"We went 1-0 up and should have controlled the game but we let Motherwell back in it. Our slack passing gave them hope and gave their crowd a lift.
"We went ahead again and still didn't control it. They were dangerous, smashing the ball off the bar and the post."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.