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.