Livingston 0-2 Dundee
First half goals from Steven Milne and Ryan Conroy booked Dundee's place in the fifth round of the Scottish Cup.
Milne produced a neat turn and shot nine minutes into an entertaining first half, while Conroy doubled the advantage from the penalty spot.
John Baird was upended after some nifty footwork and Conroy drilled in the spot-kick.
Livingston dominated possession in the second half but seldom troubled the visiting defence.
Dundee were full of beans in the first 45 minutes and Baird had the first chance of the game, heading wide after three minutes.
And the Scottish Premier League side took the lead when Milne made a good turn inside the box and sent a low shot into the left-hand corner beyond the reach of home goalkeeper Andrew McNeil.
Barry Smith's side almost doubled their lead five minutes later thanks to a good run up the right wing by Jim McAlister.
He crossed under pressure from the edge of box to Conroy, whose diagonal shot slipped narrowly wide.
Conroy succeeded in making it 2-0 from the penalty spot shortly afterwards, however, after Baird was brought down.
Livingston were furious to be denied a penalty after 20 minutes when Liam Fox's shot from the edge of the box appeared to be handled on its way through to being headed off the line.
Milne had two more close-range chances as the game entered its second quarter, first having an effort headed off the line from a corner, then almost cashing in when McNeil could only parry Baird's raking 25-yard shot, the goalkeeper managing to recover and smother the ball before Milne could get it over the line.
Livingston saw a free-kick from Jesus Garcia Tena saved by Rab Douglas before Baird had a shot deflected out seven minutes from the break.
The First Division side dominated possession as the second half got under way and saw Antony Andreu test Douglas with an early turn and shot.
Burton O'Brien tried his luck with a free-kick from deep in midfield, while Kyle Jacobs brought a good save out of Douglas with a powerful shot which the goalkeeper had to turn round his post.
McAlister's shot into the turf was put out for a corner and the set-piece delivery from the right was saved by McNeil, while Iain Davidson's effort with the rebound was blocked inches from the line by Kyle Jacobs.
Livingston continued pressing and Marc McNulty headed over late on.
An even better opening for the same player right on 90 minutes saw him shoot straight into Douglas' arms.