Having spoken to well-placed sources, I can reveal that David Miliband's preferences for his next job are in this order: 1. Prime minister before the election, 2. European foreign affairs high representative from January, 3. Leader of the opposition after the election.

Not that this is what the well-placed sources say. They say that he is totally focused on being Foreign Secretary and that he is not a candidate for any other job. My world exclusive revelation is based on deeper secrets. I happen to know that, despite occasional cunning appearances to the contrary, Miliband is a human being, and an ambitious one. He wants to be prime minister, and his appetite for the job has not been diminished by the business with the banana last year. Nor does he think it impossible that a vacancy might occur before the election. Indeed, I have heard that some rather surprising people think it a real possibility that Gordon Brown might stand down in the new year. Or that he might still be pushed.

One former Cabinet minister – there are a lot of them about, now – told me that what had changed since a year ago is that "now everybody in the Cabinet knows what everybody else in the Cabinet thinks". They all know that everyone else thinks that Labour stands a chance of depriving David Cameron of a majority if it fights the election under a different leader. All that keeps Brown in No 10 is the difficulty of organising the change so that everyone acts together.

Download the new Independent Premium app Sharing the full story, not just the headlines

This is particularly hard when the two main potential beneficiaries of a coup, David Miliband and Alan Johnson, are fixed in their belief in the "clean hands" doctrine. Miliband has repeatedly said that he is "not a plotter", and does not want to be seen as one. A Johnson supporter told me: "If a knight in shining armour comes to rescue you, do you want his hands to be dripping with blood?"

What an awkward moment, therefore, for what Miliband regards as the second most desirable job to come up. Any normal person is forgiven if, in the hysteria of anti-Blair rage, he or she failed to notice that the Lisbon Treaty creates not just a President of the European Council but also a "High Representative of the Union for Foreign Affairs and Security Policy". This is an important job, that offers the chance for an ambitious politician to influence some really big global issues, including climate change, fairer trade and world peace. Miliband is well qualified for it – assuming that Tony Blair does not get the top job. Both jobs cannot go to Britons, on the principle set out by Abraham Lincoln: "I suppose if the Twelve Apostles were to be chosen nowadays the shrieks of locality would have to be heard."

But the timetable is tricky. Vaclav Klaus, the Czech President, is ready to sign on the dotted line this week. That means that the president and the high representative may be appointed at a special summit of European leaders later this month, to start work on 1 January. Miliband has only days, therefore, to weigh up his chances of getting the Europe foreign affairs job now against those of becoming prime minister in a few weeks' time. Does he go for the higher probability of the second-preference job or a lower probability of gaining his first preference? The number of factors in the calculation would make the resulting equation look like a GCSE maths student's worst nightmare.

The latest wrinkle, for example, is the possibility that European leaders might think that one of the top three jobs (president, foreign affairs and president of the Commission) should be held by a woman.

Another factor is that, if for any reason Brown were to leave Downing Street, Johnson rather than Miliband is the favourite to succeed him. The Home Secretary has the qualities of personable reassurance best suited to a damage-limiting defensive election campaign. But he can be dull, and there would probably have to be a leadership election this time, even in the short time remaining, in which anything can happen.

For reasons that are still slightly mysterious to me, many of those closest to Tony Blair tend to favour Miliband as the next leader and to be dismissive of Johnson. Perhaps Miliband would shine in a way that Johnson failed to do in the deputy leadership campaign two years ago. So Miliband could still be prime minister – not for long, but possibly earning the party's gratitude for avoiding oblivion and possibly even with some role to play in a hung parliament.

But you can see why the greater likelihood of the European job – a bird if not in the hand at least hovering over the seed being offered – could be preferable.

Especially when you consider option three. If Gordon Brown stays on and Labour therefore loses the election badly, Miliband would be well placed to win the leadership election that would follow. I believe that Johnson, who is 59, would not be interested in being leader of the opposition. The only member of the Cabinet who could rival David Miliband would be his brother Ed, a more natural TV communicator but not a candidate yet likely to give Prime Minister Cameron sleepless nights.

If David wanted the job, it would be hard for Ed to challenge him directly, but does David want it? Leader of the opposition is a peculiarly frustrating job, and the semi-derelict state of the Labour Party might render it particularly so after the next election.

On the other hand, though, it may be that the Conservatives, forced to take difficult decisions to cut spending and raise taxes, could become unpopular quite quickly. But that is not so much a bird in the bush as one that might be in the bush behind the hedge. That is why, if he sees a reasonable chance of getting the Europe job, David Miliband is likely to go for it. And then Peter Mandelson might get to be Foreign Secretary after all.

John Rentoul blogs at independent.co.uk/eagleeye