Premier League: West Ham 2 Everton 3
Young English midfielder Ravel Morrison gave West Ham the lead at Upton Park in the first half as his shot took a significant deflection, but Baines drew the visitors level in the 62nd minute with the first of his sublime set-piece goals.
A Mark Noble penalty looked to have secured a win for the home side with 14 minutes remaining, but the midfielder was then dismissed after picking up a second yellow card and Baines fired in the resulting free-kick before debutant Romelu Lukaku headed home the winner.
Sam Allardyce, whose side have not won since the opening day, was forced into one change from the side that drew 0-0 at Southampton in their last fixture as the injured Guy Demel was replaced in defence by debutant Razvan Rat, a close-season signing from Shakhtar Donetsk.
Everton impressively defeated Chelsea 1-0 on September 14 for their first win of the season and Roberto Martinez felt no need to upset the rhythm of his team as he named an unchanged side.
The visitors began the match confidently and after a well-weighted pass from Ross Barkley, Kevin Mirallas cut in from the left before unleashing a stinging shot that Jussi Jaaskelainen palmed away.
The hosts finally registered a shot on goal, only their seventh of the season, after 31 minutes and it handed them the lead.
Matthew Jarvis cut inside from the left with purpose and shaped to shoot before laying the ball off to Morrison, whose effort was taken past the helpless Tim Howard thanks to a big deflection off Phil Jagielka.
Martinez reacted at half-time by bringing James McCarthy and Chelsea loanee Lukaku on for Steven Naismith and Nikica Jelavic. He was soon forced into another change as Bryan Oviedo replaced the injured Leon Osman.
Baines found his range just past the hour as Barkley won a free-kick just outside the area and the 28-year-old stepped up and curled a magnificent strike into the top corner of the goal.
Everton were not level for long, however. McCarthy tripped the rampaging Kevin Nolan in the penalty area 15 minutes from time and Noble converted from the spot.
A few minutes after being the hero, Noble found himself walking down the tunnel. A wild lunge on Barkley saw him given his marching orders and it proved costly as Baines once again stepped up and fired the free-kick home after 83 minutes.
And just two minutes later, Mirallas broke free down the right and crossed for Lukaku, who powered a header past Jaaskelainen to take Everton up to fourth.