Joe Bryan scored the two vital goals in extra time for Scott Parker's side - before Henrik Dalsgaard got a consolation in the last minute of added on time for Brentford.
The success marks a return to the top flight at the first time of asking for Fulham.