Third Division Queen's Park stunned Scottish Premier League Dundee in the second round of the Scottish Communities League Cup.
The visitors moved ahead in the fifth minute through Steven Milne's low shot.
But Dundee's Neil McGregor was sent off for a professional foul on Jamie Longworth, who converted the resulting penalty on 24 minutes.
Longworth set up Sean Burns to fire the Spiders into the lead 14 minutes from the end and Dundee could not recover.
Barry Smith's side, who have picked up just one point from their opening four SPL matches, become the fourth top-flight side to be beaten by lower league opposition in round two, with holders Kilmarnock, Hibernian and Ross County all eliminated on Tuesday.
The Dens Park outfit, who were without the cup-tied Martin Boyle and injured duo Lewis Toshney and Mark Stewart, started strongly with John Baird having an effort blocked by James Brough.
A looping effort from Longworth drifted just wide as Queen's Park responded.
Smith's only success so far this season was a win on penalties against Peterhead in round one
Dundee moved into the lead when Baird teed up Milne to rifle a shot past Neil Parry.
Ryan Conroy then hooked a shot just over the Queen's Park crossbar.
But the game changed when McGregor fouled Longworth in the box and referee Brian Colvin pointed to the spot before brandishing a red card at McGregor.
Longworth drove the ball past Rab Douglas to restore parity.
Queen's Park could have moved ahead with Burns' 25-yard free-kick, which was blocked by Douglas.
Dundee also threatened before the break with Parry tipping over Conroy's powerful strike.
Brough was denied by Douglas early in the second half and, at the other end, Baird's volley was off target.
Andy Robertson's shot took a massive deflection before falling narrowly past the Dundee goal.
But the Spiders did carve out a winner when Longworth's perfectly-timed pass found Burns, who dispatched a shot into the net from just inside the box.
And, despite some late pressure from Dundee, Gardner Speirs' side held on to claim a famous Hampden victory.
Queen's Park manager Gardner Speirs:
"I thought we were patient and, in the main, we used the ball well, kept it well.
"The winning goal's a smashing goal. We're delighted to be in the next round of the cup.
"It's fantastic for our players. We've played teams from the First Division and now the Premier League so they deserve every credit they get."
Dundee manager Barry Smith:
"I still think with 10 men we created enough chances to win the game.
"That's no disrespect to Queen's Park because they kept the ball well and they've got the result in the end.
"Obviously when you go down to 10 men it makes it harder but I still think we created chances and the decision-making could have been better."
"We just have to dust ourselves down and get on with it. We've got a big game on Sunday [against Hearts] and we must move on quickly and make sure that we're ready for Sunday's game."
- 01 Parry
- 02 Little Booked
- 03 Robertson Booked
- 04 Bradley
- 05 Brough
- 06 Capuano
- 08 Keenan
- 10 Anderson
- 07 Watt (Shankland - 63' )
- 09 Longworth
- 11 Burns (Ronald - 85' )
- 20 Lockhead
- 12 Gallagher
- 16 Ronald
- 14 Smith
- 15 Shankland
- 01 Douglas
- 02 Irvine Booked
- 03 Lockwood
- 05 McGregor Dismissed
- 21 Grassi Booked
- 06 Davidson
- 11 Conroy
- 16 Webster (Gallagher - 25' )
- 10 Baird Booked
- 15 Milne (O'Donnell - 63' )
- 20 McAlister
- 13 Baird
- 18 Gallagher
- 04 O'Donnell
- 32 Thomson
- 33 Ried