Mr Brown and Mr Blair laughed about the loo incident, the diaries say
Gordon Brown once locked himself into a toilet and had to be freed by Tony Blair, according to ex-Downing Street press spokesman Alastair Campbell's diaries.
Mr Brown and Mr Blair met at a friend's house in Edinburgh shortly after the death of the Labour leader John Smith.
They were discussing who should replace him.
The diaries, which refer to Mr Blair as TB and Mr Brown as GB, say: "TB was clear he should stand because he felt that was the best chance for the party, but GB was not convinced. At one point, GB went to the toilet.
"Minutes passed and TB was sitting twiddling his thumbs and even wondered if GB had done a runner. Eventually the phone went.
"TB left it, so then the answering machine kicked in and GB's disembodied voice came on: 'Tony. It's Gordon. I'm locked in the toilet.'
"They both ended up laughing about it. TB went upstairs and said: 'You're staying there until you agree.' "
The two men later made a deal at a London restaurant, Granita, where Mr Brown agreed to step aside to give Mr Blair a clear run at the Labour leadership.
It has been widely reported that in return he was given a promise that he would be able to wield huge power as chancellor, and that Mr Blair would step down and hand over power to him at some point in the future.