The U.S. thrift industry reported on Wednesday its first profit since the third quarter of 2007, earning a slender total of $4 million in the second quarter, the Office of Thrift Supervision said.

The second-quarter figure compared with a whopping loss of $1.62 billion in the first quarter of 2009, which was revised on Wednesday from a previously reported loss of only $47 million.

The OTS said the small profit was primarily due to higher net interest margins, lower provisions for loan losses and higher fee income.

The agency also said the number of problem thrifts grew to 40 at the end of the second quarter, from 31 the previous quarter. (Reporting by Karey Wutkowski, with additional reporting by Steve Eder, editing by Gerald E. McCormick)