After a host of missed chances from the impressive hosts, who made a mockery of their status a league below their local rivals, Millen provided a moment of inspiration to settle an absorbing contest.
In truth, the victory could have been more handsome but for the home side's own profligacy and an inspired display from Raith goalkeeper Kevin Cuthbert.
Dunfermline can now look forward to another derby in the next round against Falkirk and, on this evidence, will provide a stern test for another of their fierce foes.
Both sides started well, but Raith striker Christian Nade was first to threaten, albeit he appeared to pull out of a 50/50 challenge with Pars goalkeeper Ryan Scully after being played through on goal by Martin Scott. Faissal El Bakhtaoui was then presented with an even better chance for the hosts minutes later, but he flashed his shot into the side-netting from a prohibitive angle when a square ball to Michael Moffat appeared the more inviting option.
With half-time approaching, a brisk, end-to-end contest swung Dunfermline's way. Presumably with a flea in their ear following a sloppy end to the first-half, Raith emerged with renewed vigour after the break and only a superb stop from Scully denied Nade after a close-range shot.
But the hosts continued to threaten, and eventually got the winner: a low delivery from Josh Falkingham found Millen on the edge of the box. The gifted full-back showed remarkable composure and technique to curl a sensational shot into the top corner.