The Hammers were heading for their sixth league defeat of the season when Stuani sent Boro ahead early in the second period, but Payet spared the home side's blushes as the points were shared in the capital.
West Ham made a positive start to the match, but play was halted in the fifth minute of action when Sam Byram, who was one of four changes for the Hammers, went down with a hamstring problem and had to be stretchered off the field.
Alvaro Arbeloa replaced Byram as Slaven Bilic was forced into an early change and the stoppage harmed West Ham as Middlesbrough, who had Scottish international Jordan Rhodes at centre-forward, started to pass and probe in the final third.
Indeed, the visitors had the first chance of the match in the 12th minute when Viktor Fischer attempted to pick out the far corner with a low drive, but his effort just drifted wide of the post.
West Ham's first half-chance arrived in the 18th minute when Payet produced a couple of step-overs to create space inside the Middlesbrough box, but Calum Chambers came across to make a brilliant block. Moments later, Payet flashed a powerful strike wide of the far post as the home supporters were finally engaged.
Indeed, the pressure continued as Michail Antonio, who was playing at centre-forward, headed an Angelo Ogbonna cross over the crossbar, before James Collins nodded a dipping Payet free kick wide of the post.
Rhodes should have done better when the ball fell for the Middlesbrough forward inside the West Ham box as the first period continued to gather pace, and indeed the home supporters showed their displeasure as the visitors managed to enjoy a decent spell of possession in the latter stages of the opening 45 minutes.
Gokhan Tore and Mark Noble both had opportunities to send West Ham ahead in the final five minutes of the first half, but the former missed the target from inside the box, before the Hammers captain smashed the crossbar with a curling effort as the pair headed down the tunnel at 0-0.
West Ham boss Bilic made one change at the interval as on-loan Juventus forward Simone Zaza, who had been dropped to the bench for the first time since his arrival, replaced the ineffective Tore, which allowed Antonio to move into a wide position.
It was Middlesbrough that made the breakthrough in the 51st minute of action, however, when Stuani's header from a Fischer corner found a route through the crowd. Noble thought that he had cleared the ball off the line, but the referee's watch buzzed to indicate that the goal should be awarded.
West Ham were level just six minutes later though and it was a long overdue first Premier League goal of the season for Payet, who danced into the Middlesbrough box before squeezing a low strike past Victor Valdes.
The equaliser lifted the whole stadium as West Ham pushed forward for a second, but Payet could only smash a close-range free kick straight into the Middlesbrough wall, before Arbeloa and Antonio both missed the target from distance.
Both teams were pressing for a winner as the match entered its final 10 minutes of action, although clear chances were few and far between as both sets of players resorted to having efforts from distance. Antonio broke into the Middlesbrough box in the 86th minute as the Englishman looked to win it for his team, but he fired into the stands from close range as the points were shared.
Next up for West Ham, who remain 18th in the Premier League table, is a trip to in-form Crystal Palace after the international break on October 16, while Middlesbrough will host Watford one day later.