Thanks to a dramatic change in the weather, residents have begun returning home to areas that had been threatened by a devastating wildfire — but they've been told to remain alert in case conditions worsen again

The blaze that charred an area of more than 13 square miles was 40 percent contained late Saturday after a blanket of cool, moist air flowed in from the Pacific Ocean, keeping dry wind from the interior from stoking the flames again.

More fog and mist rolled in from the sea early Sunday, keeping temperatures cool and humidity high.

The National Weather Service forecast highs of up to 75 degrees Sunday, cooler than the hot, dry weather that for days combined with the wind to spread the flames.

Click here for photos.

Fire officials said the blaze destroyed 31 homes and two detached garages, and damaged 47 other home, saying an earlier estimate that 80 buildings were destroyed was incorrect.

Cheers erupted at an evacuation center when Santa Barbara County Sheriff Bill Brown announced Saturday that mandatory evacuation orders for most areas were being downgraded to evacuation warnings, meaning residents could return but would have to remain alert.

"It's easy on a day like today to look around and go 'Wow, you know, we've got this thing beat," Joe Waterman, the overall fire commander from the California Department of Forestry and Fire Protection, said Saturday evening. "We don't have this thing beat yet."

Water-dropping helicopters continued to shuttle between reservoirs and hot spots but flames were not apparent and the huge plumes of smoke that loomed over the city for days had vanished.

The blaze isn't expected to be fully contained until Wednesday.

Among the first to return were Jonathan Kenny, 44, and his wife, Susan Kim, 42, who found their home covered in ash but still standing near blackened hillsides.

"I feel like we dodged a bullet on this one," said Kenny, who watered plants and fed goldfish in a backyard pond.

But a short distance away up a narrow canyon road, homes were gutted and cars were burned-out wrecks.

More than 30,000 people had been under mandatory evacuation orders since the fire erupted Tuesday just above Santa Barbara on the face of the steep Santa Ynez Mountains. An additional 23,000 had been on evacuation standby.

By Saturday evening, well over half of the those residents were back in their homes, Santa Barbara County sheriff's Commander Darin Fotheringham said.

The fire was driving into outlying residential areas Wednesday by the notorious local wind known as the "sundowner," which sweeps from inland and down the face of the mountains late in the day. The wind returned and fanned the flames again late Thursday and into early Friday.

After that gusty onslaught, the fire was active along a five-mile-long front Friday just above Santa Barbara, west toward neighboring Goleta and east toward the community of Montecito.

However, the sundowner failed to materialize Friday night, and instead the normal flow of air from the Pacific Ocean delivered a dense, moist marine layer that didn't let the sun peek through until nearly midday.

On Saturday, the weather service dropped fire weather warnings and predicted that overnight clouds and fog would continue through Monday morning, before a return of a weak-to-moderate sundowners in the Santa Ynez range Monday night and into midweek.

Resident Eric Hall, 59, said he believed the worst was over when he felt the mist sweep in off the ocean.

"The weather is cooperating," Hall said as he had ash cleaned off his daughter's car at a car wash.

Click here for more from MyFOXLA.com.