Hibernian survived a real scare at Cowdenbeath to progress to the fifth round of the Scottish Cup.
The Second Division leaders got off to a dream start, with Greg Stewart netting after just 19 seconds.
Leigh Griffiths equalised from long distance and Eoin Doyle shot the visitors in front on 27 minutes.
David Wotherspoon headed Hibs further ahead after the break, but the part-timers hit back and a John Robertson volley ensured a tense finale.
The home fans at the ramshackle Central Park were celebrating inside the first minute when Stewart dumped Sean O'Hanlon on his backside with a neat turn and lifted a cool finish beyond goalkeeper Mark Brown.
With Hibs on a miserable run of 10 games without a win, an upset looked a real possibility, but Pat Fenlon's men responded in style, only to buckle late in the game and almost throw it away.
A lovely dummy from Doyle presented Griffiths with a perfect chance to level, but the striker duffed his shot horribly wide in complete contrast to the composure shown by Stewart.
A terrible clearance from Hibs left-back Callum Booth landed at the feet of Scott Linton, but the Cowdenbeath midfielder's shot from the edge of the penalty box flew high over the crossbar.
Booth drilled a shot through a congested penalty area, only to see it whizz a yard wide.
O'Hanlon beat Cowden goalkeeper Thomas Flynn to a corner but could not divert the ball home with his head from close range.
The visitors were level on 18 minutes when Griffiths thumped in a stunning shot from 25 yards, with Cowdenbeath player-manager Colin Cameron guilty of giving the ball away in the move that led to the goal.
Doyle, making his first Hibs start, was lively and only the fingertips of Flynn denied the Irish striker after a cute dip of the shoulder on the edge of the penalty box.
However, the former Sligo Rovers star found the net on 27 minutes.
Michael Hart was given far too much time on the ball by a retreating Cowdenbeath defence and his pass found Doyle, who tucked in the rebound from a tight angle after his first effort was blocked by the foot of Flynn.
With Hibs well on top, Griffths rattled the crossbar with a dipping free kick from distance before John Armstrong made a goal-line block to keep out a head-flick from Doyle.
Hibs were caught napping by a long ball early in the second half, but Stewart, under pressure from the lunging Booth, could not apply a finishing touch.
The Scottish Premier League outfit moved further ahead soon after when Wotherspoon dived to meet a Danny Galbraith delivery and flicked a neat header in at the near post.
Griffiths saw a shot deflected wide, but the Second Division side were far from down and out.
Taking advantage of slack play from Galbraith, Armstrong flashed a great delivery across the face of goal with Stewart and Lewis Coult both inches away from making a connection.
Brown saved comfortably from a Mark Ramsay strike before Robertson narrowed the deficit with a sublime finish.
Running on to a high ball, the flame-haired midfielder flicked it over a static opponent with one touch and steered home a sweet volley with his next.
Former Hibs trainee Flynn made a strong save to keep out an angled drive from Booth, but Cowdenbeath were right back on the attack and Robertson squandered a great chance to level.
With the visitors defending nervously on the edge of their penalty area, the ball fell kindly for the midfielder, but he skewed a shot wide when face-to-face with Brown as the keeper kept guard on his near post.
The part-timers finished the game strongly, with Hibs in complete disarray, but could not find a way to force a replay.