Carl Cort headed home Jackie McNamara's cross at the far post for his sixth goal of the campaign to give Wolves the lead after 19 minutes.
But former Wolves midfielder Jermaine Wright, just signed on loan from Leeds, volleyed home an equaliser soon after.
Wolves were made to pay for missed chances when Hayles ran through late on and lifted the ball over Michael Oakes.
Millwall manager Colin Lee:
"We stuck to our plan and won the game. We've lost games we've deserved to get something out of so it does balance itself out.
"We've had a horrendous time of giving bad goals away.
"I don't think they expected us to play that way. Sometimes when you do catch
teams unexpectedly you get the result."
Wolverhampton: Oakes, McNamara, Lescott, Gyepes, Naylor, Seol, Ricketts (Cameron 67), Anderton (Olofinjana 24), Kennedy, Cort, Clarke (Ndah 68).
Subs Not Used: Postma, Craddock.
Goals: Cort 19.
Millwall: Marshall, Ifil, Williams, Phillips, Vincent, Dunne, Wright, Morris, Livermore, May, Hayles (Serioux 90).
Subs Not Used: Fangueiro, Hutchison, Paul Robinson, Igoe.
Goals: Wright 27, Hayles 90.
Ref: U Rennie (S Yorkshire).