However, it was the home side who took the lead when Edwards's shot was deflected into the path of Afobe, and he lashed it into the back of the net from a few yards.
QPR went close to equalising a few minutes later as Tjaronn Chery stung the palms of Martinez from the edge of the box after a flick from Charlie Austin.
Wolves doubled their lead minutes later though, as Kevin McDonald smashed the ball into the back of the net from the edge of the box.
However, QPR hit back as Austin headed in Matt Phillips's cross from the left-hand side.
Wolves went close to scoring a third minutes after the break, but Afobe was denied by Rob Green.
That save proved to be crucial as the West London side equalised minutes later through Phillips, whose cross eluded everyone and nestled in the bottom corner.
Nedum Onouha then went close to giving them the lead, as his header at the back post was directed straight at Martinez from point-blank range.
Afobe went close again for the hosts when he was played through on goal by Rajiv van La Parra, but his first-time shot went inches past the post.
However, Phillips put QPR ahead with a long-range shot which Martinez couldn't keep out despite getting a hand to the ball.
Chery went close to a fourth for Chris Ramsey's men, but Martinez palmed away his free kick, before McDonald almost equalised with a shot which hit the post.