More than a dozen schoolchildren were left stranded on a ride at a Western Sydney school, following a malfunction which sparked a dramatic rescue.