The win has lifted Neil McCann's side off the foot of the table, with the result another positive step forward following last weekend's draw with Kilmarnock.
The momentum shifted to Murty's side once more, however, as Daniel Candeias, sent through one-on-one with Parish, could not lift his shot high enough over the goalkeeper.
The scrappy first half was summed up when Dundee forward Marcus Hamer and opposite number Alfredo Morelos collided just before the whistle - they were replaced by Sofien Moussa and Eduardo Herrera respectively.
The Dee were not disheartened by their loss, though, as O'Hara scuffed a shot into the bottom corner to give his side the lead after 66 minutes.
Their lead lasted just four minutes, however, as Josh Windass equalised from 13 yards out. Striker Miller had another shot blocked for Rangers, before O'Hara slotted in the winner.
Dundee's win takes them to 12 points for the season as Rangers missed out on the opportunity to go second in the top flight.