Holders Rangers eventually overcome Partick Thistle in a controversy-laden Scottish Cup last-16 encounter.