It appeared to be going all so smoothly for the Light Blues when Ovie Ejaria curled home a precious away goal after just 10 minutes.
But Dmitri Sysuev’s equaliser gave the Russians hope before Alfredo Morelos’ moment of madness put Rangers under the cosh.
The Colombian was sent off after collecting two quick-fire bookings and was followed down the tunnel by Jon Flanagan when the defender was also dismissed after the break.
But try as the hosts might, Gers refused to buckle and got the result which secured a 2-1 aggregate triumph and qualification to the main phase of a European competition for the first time since 2010.
Ejaria’s goal was just the start Rangers were looking for.
Morelos robbed Jamal Tabidze before Gers worked the ball to the left flank for Flanagan. The full-back’s cross was only half-cleared by Ionut Nedelcearu and Ejaria made him pay as he swept a stunning finish into the corner.
Ufa initially looked shell-shocked but soon recovered.
Connor Goldson was forced to produce a last-ditch block on Sysuev on the half-hour mark - but two minutes later there was no denying the frontman.
Rangers’ defence had stepped up but Sysuev did not hang about for a flag and raced in to slot past Allan McGregor as the visitors appealed in vain for offside.
Gers boss Steven Gerrard needed his team to remain calm - but instead saw Morelos lose his head, first booting the ball away after giving away a foul. He then aimed a verbal blast at the linesman before completing his meltdown by giving referee Tobias Stieler a dismissive wave.
The German official already had a yellow card in his hand for the Colombian’s first offence and immediately flashed it a second time to leave Rangers stunned.
There was still eight minutes left of the half and Ufa sensed blood, coming close twice before the break as Sysuev flashed wide before teeing up Sylvester Igboun for a back-post header the Nigerian should have converted.
Ryan Kent almost fired Rangers back in front but Ufa keeper Aleksandr Belenov produced a stunning stop to deny the winger after a mazy run.
Ufa, though, were still giving Rangers cause for panic. Dmitri Zhivoglyadov fired over, Igboun again headed wide while Ivan Oblyakov somehow failed to hit the target when clean through on goal.
The task of keeping the Russians at bay grew even harder as Flanagan got his marching orders with 24 minutes left. The former Liverpool man had already been booked for a foul in the first half and looked stunned as he was given a second for a tame collision with the same man.
Ufa still needed two goals but McGregor was in defiant mood - brilliantly saving an Igboun header with a flying save - as was Gerrard’s back four as they put their bodies on the line time after time.
There was time for a couple of late scares as Vyacheslav Krotov flicked a header against a post while Tabidze did find the net only to see his header ruled out after a barge on Ejaria, but Gers stood firm through four nervous minutes of stoppage time.