The Kirk's General Assembly in the Scottish capital threw out a bid by an Edinburgh minister to allow only men and women in heterosexual relationships or celibate homosexuals to preach.
More than 700 senior figures at the annual gathering agreed to continue to move towards allowing local church leaders to decide whether they want a gay minister who is in a civil partnership.
The assembly voted 369 in favour of continuing its compromise position and 189 against.
The Rev Jeremy Middleton moved to overturn the Kirk's plan to continue to allow non-celibate gay clergy through its compromise deal reached last year.
He said the move proposed by the Church is legally questionable. He said: "I don't believe that the overture [proposal] is legally watertight.
"It runs the risk of putting the Church in a difficult and dangerous position in terms of claims that could be made on the basis of discrimination. There is a catalogue of loose ends."
He added: "Firstly, it is risky, secondly, it is ragged, and thirdly, it is wrong, because it is illogical."
The Rev Mark Malcolm of Chryston, Glasgow, said he backed the evangelical's push as the current stance "sets minister against minister, congregation against congregation and member against member".
It was claimed the Church's stance has led to people quitting Christianity all together.
The Kirk's Theological Forum that examined the issue over the last year urged members to continue to allow the compromise deal that allows Kirk Sessions to decide whether to let a gay minister take up a local role.
The Very Rev Professor Iain Torrance said in his forum report to the assembly that the Kirk is already in a compromise position.
He said: "The church in the past has offered various kinds of safeguards for those who in all conscience and commitment disagree.
"There was always a provision that those who disagreed were not obliged to conduct the marriages of divorcees."
He said that the kind of "mixed economy of constrained difference is understandable within our practices of Bible reading and may be located within our tradition".
The Rev Bryan Kerr of Greyfriars Church in Lanark, said that the Kirk's compromise proposal "brings us the best chance we have for the peace and unity of our church".
The Rev Hector Morrison, Principal of the Highland Theological College, gave an emotional address.
He said members have gone because "they no longer trust our ability or our willingness to follow what they believe the Bible clearly states".
"We cannot afford any other church families to be torn apart in this way. We cannot afford to lose any more ministers or budding ministers," he said.
The Rev Alan Hamilton, whose committee examined the law around the issue, said: "We understand the anguish and pain felt by good people on all sides of the debate. We understand that particular parts of the overture will look very different from different perspectives.
"I venture that there is hardly a section in this overture which does not disappoint someone."
Forward Together, a group for evangelicals in the Church of Scotland, said it was " deeply saddened and dismayed" but urged traditionalists not to act hastily.
A total of 13 ministers and hundreds of ordinary members have left the Kirk since 2009 following the appointment of the Rev Scott Rennie, who is openly gay, to an Aberdeen church.
The plan will now be sent to the Kirk's 49 presbyteries before it is raised at next year's General Assembly.