Arsene Wenger's side needed three points to guarantee a spot in next season's Champions League qualification rounds ahead of north London rivals Tottenham and Laurent Koscielny's second-half strike ensured they achieved that aim.
Koscielny's goal meant more heartache for Spurs who have developed an unfortunate habit of missing out on Champions League action on the last day of the season and once again had to settle for the place in the Europa League that comes with finishing fifth despite their 1-0 win against Sunderland at White Hart Lane.
Ferguson was taking charge of United for the 1 500th and final time before retiring and the Scot looked set to bow out with a win as the Premier League champions romped into a 5-2 lead.
But Albion scored three times in the last nine minutes in an incredible finish to spoil Ferguson's farewell at the Hawthorns.
At St James' Park, Arsenal bagged the priceless goal when French defender Koscielny swivelled to volley home from close-range after Lukas Podolski flicked on Theo Walcott's free-kick in the 52nd minute.
The victory secured Arsenal's 16th consecutive Champions League qualification and will ease the pain of another trophyless season for the Gunners who trailed Tottenham by seven points at the start of March.
Spurs struggled to break down Sunderland until the closing moments, even though Black Cats midfielder David Vaughan was sent off for a second booking in the 75th minute.
They finally took the lead when Bale, who had earlier been booked for diving in a bid to win a penalty, cracked a stunning strike into the top corner from long range in the 90th minute, but Arsenal were just seconds away from victory by then.
At the Hawthorns, Ferguson's commitment to attacking football was on display one last time but the United boss will have been less impressed with his defenders.
Since taking charge of United for the first time in a 2-0 defeat at Oxford on November 8, 1986, Ferguson has amassed an incredible 38 trophies, including 13 Premier League titles and two Champions League crowns.
This was his swansong, as well as the final game before retirement for United midfielder Paul Scholes, who came on as a second-half substitute, and it was suitably dramatic.
Netted for United
Japan midfielder Shinji Kagawa got United's first in the sixth minute and Albion defender Jonas Olsson scored a ninth-minute own goal.
Alexander Buttner smashed in United's third in the 30th minute before James Morrison got one back for the hosts in the 40th minute.
Romelu Lukaku scored for Albion in the 50th minute before Robin van Persie netted for United three minutes later and Hernandez bagged the fifth in the 63rd minute.
Yet Albion provided an incredible finale as Lukaku and Youssouf Mulumbu both scored in the space of 60 seconds in the 81st minute before on-loan Chelsea striker Lukaku completed his hat-trick to equalise in the 86th minute.
Ferguson will be succeeded at Old Trafford by Everton manager David Moyes, who saw his team beaten 2-1 at third-placed Chelsea in his farewell after an 11-year reign.
Chelsea midfielder Juan Mata slotted home in the seventh minute. Steven Naismith equalised for Everton seven minutes later, but Fernando Torres struck the winner in the 76th minute.
Chelsea's interim manager Rafael Benitez, who masterminded the team's Europa League final victory over Benfica in Amsterdam in midweek, was also saying goodbye, with Jose Mourinho reportedly lined up to return to west London once he quits Real Madrid.
On a day of emotional farewells, Jamie Carragher captained Liverpool on his 737th and final appearance for the club, a 1-0 win over already-relegated QPR at Anfield.
Carragher hit a post in the second half, but Philippe Coutinho got the only goal, lashing home from long-range in the 23rd minute.
Manager-less Manchester City, already guaranteed to finish second, were beaten 3-2 at home by Norwich.
Jack Rodwell scored twice for City, led by Brian Kidd following Roberto Mancini's sacking on Monday but goals by Anthony Pilkington, Grant Holt and Jonathan Howson won it for the Canaries.
Stoke striker Michael Owen made a 16-minute cameo appearance before his retirement in his team's 1-1 draw at Southampton.
FA Cup winners Wigan, already relegated, drew 2-2 with Aston Villa, while second bottom Reading lost 4-2 at West Ham and Fulham won 3-0 at Swansea. –Sapa-AFP