Sunderland started the second half brightly as Simon Adingra poked fellow winger Chemsdine Talbi’s deflected cross wide and Ballard headed another corner off-target either side of home manager Régis Le Bris losing Dutch defender Jenson Seelt to injury.
Then, on 61 minutes, the Stadium of Light erupted as Seelt’s replacement Omar Alderete launched a long, diagonal cross into the box and Mayenda timed his jump perfectly and headed down and inside the left-hand post.
Graham Potter sent on Callum Wilson and Tomáš Souček in a bid to level things up, but instead Sunderland doubled their lead two minutes later.
This time, the long, diagonal cross came from the right boot of Adingra, took a slight deflection, and centre-back Ballard rose to power his header high into the net.
It took until the 78th minute for West Ham to fashion a shot in the second half, when Diouf’s first-time effort was deflected wide. Former Newcastle man Wilson was then denied a debut goal as his flicked header from Andy Irving’s free-kick was acrobatically tipped over by Roefs.
It was all too little, too late, though, as substitute Isidor raced away and beat Hermansen from distance and the home fans celebrated their team going top of the Premier League in the summer sunshine.
Sunderland: Roefs, Hume, Ballard, Seelt (Alderete 53), Reinildo, Xhaka ©, Sadiki, Diarra, Talbi, Adingra (Le Fée 76), Mayenda (Isidor 76)
Subs not used: Patterson (GK), Neil, Roberts, Rigg, Jones, Guiu
Goals: Mayenda 61, Ballard 73, Isidor 90+2
West Ham United: Hermansen, Wan-Bissaka, Todibo (Irving 82), Kilman, Aguerd, Diouf, Rodríguez (Wilson 71), Ward-Prowse (Souček 71), Paquetá, Bowen ©, Füllkrug
Subs not used: Areola (GK), Walker-Peters, Scarles, Mavropanos, Álvarez, Potts
Booked: Kilman
Referee: Rob Jones
Attendance: 46,233