Jamie Proctor fired Preston ahead inside five minutes and Barry Nicholson had the Lilywhites back in front after Anthony Edgar had levelled for the Glovers.
Former Liverpool striker Mellor notched his first on 59 minutes and, although Steven MacLean also grabbed a double, the 28-year-old's second strike on 70 minutes proved decisive.
Preston went ahead when Graham Alexander's clever free kick found its way to Proctor who smashed it home. Yeovil levelled on 31 minutes when Edgar's sweetly-struck volley from 12 yards out squirmed under Iain Turner and into the net.
Preston re-took the lead with Nicholson's goal on 49 minutes and Mellor made it three when his determined run saw him plant a firm header in the top corner.
Yeovil pulled one back on 64 minutes through MacLean's drive, which went through Turner's hands and into the empty net, but Mellor restored the two-goal lead on 70 minutes, making MacLean's 81st minute penalty too little too late.