Raith, who defeated Rangers at Ibrox in the last round, were unbeaten in half a dozen away games before Tuesday night but lacked the invention and guile to unlock a determined home defence.
Greg Tansey had an early goal attempt from 20 yards that failed to trouble David McGurn in the Raith goal before Devine worked the Rovers goalkeeper with a header.
Edward Ofere was the next to threaten for the Premiership side but it was not all one-way traffic as David Raven threatened to put through his own goal as he cut out a Rovers cross.
Raven went close at the other end but the nearest either side came to a first-half breakthrough came in added time when Danny Williams saw his shot from distance beat McGurn but clip the top of the crossbar.
Marley Watkins blasted wide as the home side pressed once more and the Inverness man was soon threatening again with a header that tested McGurn.
The decisive moment arrived when Devine outmuscled the defence to meet a Tansey corner in the 63rd minute and his six-yard header went in off the goalframe.
Rovers’ Christian Nade briefly threatened before being squeezed out but the home side held out with undue alarm to book their first trip to the national stadium in more than a decade.