Partick Thistle needed a penalty save from Scott Fox before knocking Cowdenbeath out of the League Cup in a breathless period of extra-time.
Fox pushed away a spot-kick from Jamie Stevenson as the visitors wasted the best chance of a goalless 90 minutes.
Jags substitutes Christie Elliot and Steven Lawless netted either side of a great solo effort from Kane Hemmings as play raged from end to end.
And skipper Aaron Muirhead settled the issue from the penalty spot.
Thistle had survived a couple of early scares before the first half settled into a rhythm of the hosts knocking the ball about inside the opposition half but rarely getting in behind or round the outside of a packed Cowdenbeath defence.
Striker John Baird was often lacking in support and he had Thistle's best first-half effort when he met Stephen O'Donnell's cross first time from 12 yards which Grant Adam got down well to hold.
Baird had a better chance two minutes after the break when James Craigen's flick put him through but Adam again blocked his powerful strike.
Cowdenbeath left-back Kenny Adamson gave his side the perfect chance to take the lead in the 55th minute when he shimmied past one man before wrong footing Muirhead, who stuck out a foot and tripped him up inside the box.
Jamie Stevenson slowed down his run-up but Fox dived low to his right to push the midfielder's spot-kick wide.
Lawless and Kris Doolan came on but Thistle still struggled to create clear chances before putting more pressure on as the 90 minutes progressed.
Baird went down in the box under pressure from Nathaniel Wedderburn in injury-time but referee John McKendrick booked him for diving and there was still time for Adam to block Doolan's shot.
Another substitute, Elliott, finally broke the deadlock two minutes into extra-time when he angled a shot inside the far post after being set up by fellow sub Lawless inside the box.
But Cowdenbeath went straight up the park and levelled when Hemmings burst into the box following a powerful run and shot low into the corner.
The former Rangers forward then saw a shot brilliantly saved by Fox after a one-two with Jordan Morton and John Armstrong headed wide from the resulting corner.
Gabriel Piccolo blazed over following a corner at the other end but Thistle found the net in the 103rd minute when Doolan's lay-off fell to Lawless and the former Motherwell man fired low into the bottom corner.
Fox saved a powerful Hemmings strike and Thistle wrapped up the win with four minutes left when Muirhead sent Adam the wrong way after Morton had brought down Lawless just inside the box.
Live Text Commentary
The whistle goes and the game ends after extra time.118:27
Shot by John Baird missed to the left of the net.115:53
Steven Lawless takes a fantastic shot. A parry by Grant Adam prevents the goal.113:59 Goal scored
Goal! - Aaron Muirhead - Partick 3 - 1 Cowdenb'th Penalty scored by Aaron Muirhead. Partick 3-1 Cowdenbeath.113:29
Steven Lawless fouled by Jordan Morton, the ref awards a Penalty.113:17
Header at goal by Christie Elliot goes over the bar.112:27
Corner taken by Ross Forbes.111:37
Kane Hemmings has an effort at goal. Scott Fox safely holds on.110:56
Shot by Christie Elliot went wide of the right-hand upright.109:44
Ross Forbes makes a clearance.109:38
James Stevenson takes the free kick.109:34
Stuart Bannigan gives away a free kick for an unfair challenge on James Stevenson.107:44
Shot by Jordan Morton went wide of the left-hand upright.105:01
The game restarts for the second half of extra time.103:41
Free kick taken by Grant Adam.103:35
The referee blows for offside.102:13
Kris Doolan provided the assist for the goal.102:13 Goal scored
Goal! - Steven Lawless - Partick 2 - 1 Cowdenb'th Steven Lawless slots the ball left footed into the goal. Partick 2-1 Cowdenbeath.101:12
Shot by Gabriel Piccolo cleared the crossbar.101:00
Corner from the left by-line taken by Ross Forbes.
Clearance made by Gabriel Piccolo.98:51
James Stevenson restarts play with the free kick.98:22
Free kick awarded for a foul by Gabriel Piccolo on Nathaniel Wedderburn.96:18
Kane Hemmings has an effort at goal. Scott Fox catches the ball.95:27
Header by John Armstrong misses left.95:16
Corner from the right by-line taken by James Stevenson.94:44
Corner taken by James Stevenson from the left by-line.94:34 Substitution
Substitution Greg Stewart goes off and Kyle Miller comes on.93:48
Kane Hemmings takes the chance to get an effort at goal. A parry by Scott Fox prevents the goal.92:38 Goal scored
Goal! - Kane Hemmings - Partick 1 - 1 Cowdenb'th Kane Hemmings scores a left footed goal. Partick 1-1 Cowdenbeath.91:47
The assist for the goal came from Steven Lawless.91:47 Goal scored
Goal! - Christie Elliot - Partick 1 - 0 Cowdenb'th Christie Elliot slots the ball left footed into the goal. Partick 1-0 Cowdenbeath.90:00 +3:28
The whistle goes for the end of normal time.90:00 +2:52
Free kick crossed by Ross Forbes.90:00 +2:45
Aaron Sinclair fouled by Jordan Morton, the ref awards a free kick.90:00 +2:32
Corner taken by Ross Forbes from the left by-line.90:00 +2:03
Kris Doolan takes the chance to get an effort at goal. Grant Adam parries the effort to safety.90:00 +0:56
Free kick taken by Grant Adam.90:00 +0:30 Booking
John Baird is cautioned by the ref for unsporting behaviour.89:19
Free kick crossed by Jordan Morton.89:10
Aaron Sinclair concedes a free kick for a foul on Greg Stewart.88:19
Steven Lawless takes a weak shot and cleared the goal.87:57
Corner from the right by-line taken by Steven Lawless.87:25
Corner taken by Steven Lawless from the left by-line.86:43
Corner taken by Ross Forbes from the left by-line.84:28
Shot by Ross Forbes cleared the net.83:37 Substitution
Substitution Kallum Higginbotham leaves the field to be replaced by Christie Elliot.82:10
Steven Lawless takes the chance to get an effort at goal.81:28
Stuart Bannigan takes the free kick.81:19
Free kick awarded for a foul by Thomas O'Brien on Kris Doolan.80:46
Direct strike on goal from the free kick by Ross Forbes goes right of the target.80:09
Nathaniel Wedderburn concedes a free kick for a foul on Ross Forbes.79:05
Shot by Kane Hemmings went wide right of the target.77:21 Substitution
Substitution Marc McKenzie goes off and Jordan Morton comes on.71:58 Substitution
Substitution Kane Hemmings comes on in place of Andrew Russell.71:20
Free kick crossed by Aaron Sinclair.70:57 Substitution
Substitution Kris Doolan replaces Mark Kerr.70:29
Foul by Dean Brett on Kallum Higginbotham, free kick awarded.67:16
Gabriel Piccolo makes a clearance.67:08
Corner taken by James Stevenson from the right by-line.66:02
Steven Lawless takes a brilliant shot and cleared the crossbar.65:01
The ball is swung over by Dean Brett.62:57
Ross Forbes takes a shot and went wide of the left-hand post.62:30
Ross Forbes crosses the ball in from the free kick.62:22
Free kick awarded for an unfair challenge on Steven Lawless by Kenneth Adamson.61:25
Grant Adam crosses the ball in from the free kick.61:08 Substitution
Substitution Steven Lawless on for James Craigen.60:46
The offside flag is raised against Kallum Higginbotham.60:07
Aaron Sinclair makes a clearance.59:48
Corner taken by James Stevenson.55:06
Clearance by Gabriel Piccolo.55:00
Corner from the right by-line taken by James Stevenson.54:38 Penalty
Scott Fox makes the save from the spot kick. Partick 0-0 Cowdenbeath.54:31 Penalty
Penalty taken by James Stevenson saved by Scott Fox. Partick 0-0 Cowdenbeath.53:22
Penalty awarded for a foul by Aaron Muirhead on Kenneth Adamson.53:05
Stephen O'Donnell concedes a free kick for a foul on James Stevenson.51:43
Shot by James Stevenson missed to the right of the target.50:57
Free kick crossed by James Stevenson.50:47
Gabriel Piccolo gives away a free kick for an unfair challenge on Greg Stewart.49:04
Corner from the right by-line taken by Ross Forbes.46:53
John Baird takes a brilliant shot.45:01
The game restarts for the second half.45:00 +0:41 Half time
Half Time The half-time whistle blows.42:44
The ball is crossed by Ross Forbes.41:49
Kallum Higginbotham restarts play with the free kick.41:43
Nathaniel Wedderburn challenges Kallum Higginbotham unfairly and gives away a free kick.40:53
The ball is sent over by Stephen O'Donnell.39:32
Free kick crossed by Grant Adam.39:13
The official flags Stephen O'Donnell offside.38:16
Header at goal by Gabriel Piccolo to the left of the net.38:02
Corner taken by Ross Forbes from the left by-line.37:00
Grant Adam takes the free kick.36:49
The referee blows for offside.36:03
Ross Forbes takes a shot. Grant Adam catches the ball.34:30
Ross Forbes takes a shot. Grant Adam safely holds on.33:36
Free kick taken by Grant Adam.33:19
The assistant referee signals for offside against James Craigen.30:05
Stephen O'Donnell takes the free kick.29:59
The referee blows for offside.26:23
Kallum Higginbotham has an effort at goal and missed to the left of the target.26:01
Free kick crossed by Ross Forbes.25:03
Andrew Russell concedes a free kick for a foul on Aaron Sinclair.20:58
John Baird takes the chance to get an effort at goal and missed to the left of the target.20:45
The ball is sent over by Stephen O'Donnell.19:55
Shot by John Baird. Grant Adam catches the ball.16:07
Shot by John Baird cleared the target.15:53
Centre by Aaron Sinclair.13:14
Free kick taken by Lewis Milne.12:58
Stuart Bannigan gives away a free kick for an unfair challenge on Greg Stewart.7:07
Grant Adam restarts play with the free kick.6:59
The assistant referee signals for offside against Kallum Higginbotham.6:25
Clearance made by Aaron Muirhead.6:06
Corner from the right by-line taken by James Stevenson.4:52
Andrew Russell takes the chance to get an effort at goal.4:06
Kallum Higginbotham takes a shot and went wide right of the goal.3:20
Nathaniel Wedderburn has an effort at goal and missed to the right of the goal.2:00
Thomas O'Brien manages to make a clearance.1:52
The ball is sent over by Aaron Sinclair.0:44
James Stevenson takes a shot. Scott Fox catches the ball.0:00
The referee gets the game started.
Live data and text provided by our data suppliers