Gordon's last foray in Sudan was a "quintessential Victorian melodrama, which ended with the death of its hero", in the words of Karl E. Mayer (Kingmakers - The Invention of Modern Middle East, chapter 1).
Gen. Gordon, who had been a soldier of fortune for almost all his life and enjoyed a towering reputation at home even if he had never enjoyed a major command in the British army, was in England on his way to Congo when the Mahdist insurrection boiled up and an anglo-egyptian army commanded by gen. Hicks was massacred at Shaykan, 30 miles south of El Obeid. The remnants of the army retreated to Khartoum, where they were soon besieged by the Mahdists.
The idea of using Gordon was firstly sponsored by the editor of the Pall Mall Gazette, with a lengthy interview to the general published in January 1884. Gladstone - who was firmly against additional entanglements in Africa - had to deal with a divided ministry and ultimately agreed to send Gordon to Egypt and Sudan, but with very clear instructions: organize the evacuation of Egyptian troops and all westerners from Khartoum. The appointment of Gordon was supported (with many misgivings) by Evelyn Baring, who was the effective imperial British proconsul in Egypt and had arrived two years earlier in Cairo (where he would remain until 1907).
However Gordon had spoken very clearly in the Pall Mall Gazette interview: the danger in his view was not a Mahdist invasion of Egypt, but rather the risk that "In all the cities of Egypt it will be felt that what the Mahdi has done they may do: as he has driven out the intruder and the infidel they may do the same".
What Gordon had in mind was pretty clear: retreat was not an option. It is true that Gordon agreed to "consider and report on the best mode of effecting the evacuation of the Sudan", but he was also a loose cannon, and as a matter of fact he wrote 8 months later in his journal from Khartoum "I own to having been very insubordinate to Her Majesty's government and its officials, but it is my nature and I cannot help it. .... I know if I were the chief I would never employ myself, for I am incorrigible."
To complete the picture, Gordon had had a spiritual crisis in Palestine in 1882 and his behavior in Sudan was pretty erratic, ranging from plans to annihilate the Mahdists to attempts to negotiate a peace with the Mahdi himself, offering him the title of Sultan of Khordofan (the Mahdi refused), and even proposing the name of Zubair Pasha (a notorious slaver whom he had chased all over Darfur during his tenure as governor of Equatoria) as Governor General of Sudan and to permitting the resumption of slave trade outlawed in 1877.
It was quite a long preamble (but I do recommend "Kingmakers") to justify my conclusion: if Gordon had not been offered a position in Sudan, and he had gone ahead with his plans to work for Leopold in Congo it is very unlikely that anything good might have come out: it is almost certain that Gordon and king Leopold would have had major disagreements very soon, and at the same time it is quite unlikely that queen Victoria would have accepted that the British government would put unduly pressure on his uncle. Probably it would end up with Gordon being dismissed in disgrace.
Another interesting point is that Gordon's fears of unrest in Egypt and in the Middle East proved untrue. Notwithstanding the new Mahdist success at the siege of Khartoum, neither the Mahdi (who died 6 months after the siege of natural causes) nor his successor Abdullah ibn Mohammad ever tried to invade Egypt. No particular unrest was generated in Egypt (aside from the general dislike for the British de-facto occupation of the country). When Kitchener was instructed to restore order in 1898 he did not have any problem in doing so: 50,000 Mahdists attacked at Omdurman the 25,000-strong expeditionary force, well entrenched and armed with guns and machine guns, and were slaughtered (loosing 20,000 men against 48 anglo-egyptians). The Sudan was re-organised as an anglo-egyptian co-dominium (an obvious fig leaf), and almost no guerrilla ensued.
The main effect of the whole Sudanese crisis was the resignation of Gladstone (after the death of Gordon).