Labour's Ruth Cadbury paid an emotional tribute to her mother and late father after squeaking in as MP by fewer than 500 votes.
But her majority of just 465 votes in the election was much slimmer than forecast by an opinion poll in the constituency published earlier this year.
Ms Cadbury received 25,096 votes, compared with 24,631 for Ms Macleod, with UKIP's Richard Hendron a distant third on 3,203 votes.
She thanked her husband Nick and children, Joe and Sam, for their "love and tolerance" during the hard-fought campaign, before paying tribute to her mother Jill and late father Charles.
"It's my mum along with my late dad whom I have to thank for for instilling in me the values of social justice which are so important," she said.
Ms Cadbury, who has been a councillor in Brentford for more than two decades, also praised Ms Macleod for her work as MP over the last five years.
"She's worked on issues that are important to the local community and I will be continuing many of them and hopefully many more, but thank you Mary," she said.
"I've represented local people for two decades on the council and I most of all want to thank the people of Brentford & Isleworth for giving me the opportunity to stand up for them in parliament."
Ms Cadbury followed her victory speech by sharing a celebratory jig with supporters, shaking off the strains of what had been a draining campaign and nerve jangling night.
An opinion poll published by Lord Ashcroft in January had predicted an 8% swing from Conservative to Labour in the constituency, which would have put Ms Cadbury a whopping 13 percentage points clear.
But the reality proved much closer, with Labour on 43.6% (up from 33.4% in 2010), compared with a 42.8% (37.0%) share for the Tories.
The Liberal Democrat vote collapsed as it did across much of the country, with Joe Bourke receiving 2,305 votes compared with 12,718 for Andrew Dakers at the last general election. He limped in ahead of the Green Party's Daniel Goldsmith, who garnered 2,120 votes.
Turnout was 70.0%, well up on the 64.7% who voted in 2010.
Ms Macleod insisted she and her team could not have done anything more. She said she had enjoyed the last five years and had yet to decide what lay in store for her next.
"I look back at the last five years and say what difference have I made to people's lives here? Have I really helped transform the community and campaigned on the things people care about? The answer to those questions is yes," she said.
"It was an incredible privilege to have been MP for the last five years and I will always treasure that time and the people I've met in the local community who have inspired me in the work I've been doing.
"I want to have a little rest now. I've worked all my life. I had two jobs aged 16 and worked my way through university, cooking breakfasts at 6am. Who knows what challenge is around the corner?"