An Australian schoolboy has undergone emergency heart surgery at a NSW hospital after a judge overruled his parents protests that the procedure could violate the family's religious beliefs.