Championship side Rangers had most of the possession and created a number of chances in the second-round clash.
But Marquis' 76th-minute penalty put Pompey ahead and Harness sealed their win five minutes later.
Marquis tucked away the resulting spot-kick after being brought down by Toni Leistner.
And worse followed for the hosts when Ross McCrorie sprinted past Leistner on the left and laid the ball across to Harness, who applied the finish.
Marc Pugh had missed a great chance for QPR early in the second half, heading straight at Craig MacGillivray from Ryan Manning's cross.
QPR dominated large spells of the first half and almost scored a brilliant early goal.
A lovely team move started by keeper Liam Kelly – left out of the Scotland squad in favour of MacGillivray – led to Ilias Chair playing in Jan Mlakar, whose ball across the face of goal just evaded Bright Osayi-Samuel at the far post.
However, for all their neat approach play, Rangers were unable to break the deadlock and Pompey took full advantage after Leistner's rash challenge.
QPR's miserable night was summed up when a goal was initially given after Ebere Eze fired into the net in injury time.
But the effort was disallowed for offside after referee Ross Joyce consulted his assistant.