Calum Gallagher's volley gave the Championship side an early lead in Paisley.
Gallagher then set up Stephen Mallan to drive in the Buddies' second midway through the first half.
Scott Agnew stroked home St Mirren's third before the break and League One Dunfermline fell further behind late on when Mallan crashed in his second.
St Mirren progressed to the semi-finals of the Scottish Challenge Cup with a comfortable win over Dunfermline.