The New York City Department of Education won a last-minute appeal to keep churches from meeting for worship in public schools, revoking previously issued permits just hours before congregations were scheduled to gather.