Only once. Pakistan and Indian fought one another very briefly (a span of three months) in a small conflict known as the Kargil War. Pakistani forces infiltrated over the line of control between the two countries and Indian forces conducted an operation to drive them out. At the time, both Pakistan and India had access to relatively newly-developed nuclear weapons.
There was a brief moment in which the international community thought that the conflict could turn into a nuclear war when the Pakistani government apparently began shifting missile launchers closer to the border. The Prime Minister of Pakistan, Nawaz Sharif, was actually on his way to meet President Bill Clinton of the United States at the time the missiles began to move. PM Sharif had called for the meeting because he felt that the conflict was going strongly against Pakistan, international opinion was largely against Pakistan, and he wanted President Clinton to negotiate a peace deal between the two states. Clinton and Sharif sat down for a meeting at the White House and Clinton essentially browbeat Sharif into making sure that his military stood down the movement of their nuclear weapons and that Pakistan withdrew its forces back across the line of control by threatening to release a press statement condemning Pakistan for starting the conflict, blaming them for funding terrorists, and ultimately putting the US firmly on the side of India in any peace deal. He also pointed out to Sharif that the use of even one nuclear weapon would constitute a complete disaster on an international scale and especially bad for Pakistan if they were the ones who fired first, facts that Sharif readily acknowledged. Sharif agreed to Clinton's demands and Pakistan backed everything down and withdrew. Later on, Sharif claimed that he was unaware that the nuclear weapons were moving and attributed their movement to Pervez Musharaf, at the time Pakistani Chief of Army Staff and main architect of the Kargil operation. Musharaf later stated in his own biography that Pakistan's delivery systems weren't even operational at the time he was moving the warheads, but he may or may not be telling the truth.
So, in summary, what prevented the use of nuclear weapons in the Kargil War? First, there was the diplomacy and planning of Bill Clinton and his staff in order to force Pakistan to back down from nuclear weapon usage. Second, there was Sharif's ability to recognize and understand his country's position and acknowledge that breaking the nuclear taboo (the long-standing, unspoken norm in international society against using nuclear weapons) would be devastating for the world and his country. Third, there is there very real possibility that Pakistan could never have used the weapons, even if they wanted to, and were just moving the missiles to showboat and try and gain leverage over India, i.e., there never was a threat to begin with.
TLDR: Careful diplomacy and adherence to international norms halted the use of nuclear weapons.
Source: http://yaleglobal.yale.edu/content/day-nuclear-conflict-was-averted
There was a border war in 1969 between China and the USSR that was only resolved in 2004. The bulk of the fighting, which marked a low point in sino-russian relations, was around Zhenbao Island on the Ussuri river. This conflict was not a large one: neither side dedicated more that a few thousand troops. Local nuclear response was held in check by the idea of MAD, and the acknowledgement on both sides that this was a limited war for political points; both sides knew that any use of tactical nuclear weapons would quickly devolve into an all-out bombardment. In the calculus of both side's leadership, a small island was not worth the prospect of losing a major city or military base to a nuclear bomb.