* Trust firm says agreement reached with investors
* Precedent-setting shadow bank default apparently averted
* Shanxi province govt may have contributed to bailout
* Analysts say major shadow-bank default a matter of time
(Adds magazine reports on repayment terms, and background)
SHANGHAI, Jan 27 (Reuters) - A Chinese trust firm said on Monday it had reached an agreement to resolve a troubled high yield investment product, just days away from what could have been a precedent setting default in China's shadow banking system.
The 3 billion yuan ($496 million) product, based on a loan to a struggling unlisted coal company which has since collapsed, was due to mature on Jan. 31.
The product was created by China Credit Trust Co Ltd and sold to wealthy investors through branches of Industrial and Commercial Bank of China , the world's largest bank by assets.
In a notification to investors, obtained by Reuters, the trust firm declared that an accord had been reached and advised investors to contact client managers, but the document, did not say how or when investors would be repaid.
"Currently, the trustee has reached an agreement with investors," China Credit Trust said.
Citing an unnamed investor in the trust product, Caixin, a respected financial magazine, reported on Monday that the agreement allows investors to recover their invested principal, but not the final interest payment originally promised.
Local media had previously reported that the government of central China's Shanxi province was likely to contribute 50 percent of the cost of bailing out investors in the product, called "Credit Equals Gold #1", while ICBC and China Credit Trust would each pitch in 25 percent.
ICBC declined to comment on Monday afternoon. A client manager for China Credit Trust said that the firm would only provide information to investors.
A default could have shattered the widespread perception that even high-yielding investment schemes enjoy an implicit guarantee from state banks and the partner institutions.
Market watchers say that could have led shadow-bank lenders to cut credit to property developers, local governments, and other weak borrowers who have relied on trust loans and other forms of off-balance-sheet borrowing to stay liquid in recent years.
Trust loans accounted for 11 percent of corporate fundraising in 2013, compared to 55 percent for bank loans and 10 percent for corporate bonds, central bank data shows.
Analysts say potential remains for default in China's murky shadow banking system.
"We think this is a systemic problem. If various local governments keep bailing out defaults, the moral hazard, i.e. that there is an implicit government guarantee on debt that's big enough ... will keep getting strengthened," David Cui, China equity strategist with Bank of America-Merrill Lynch in Hong Kong, wrote in a note to clients on Monday.
"It's difficult to imagine that the central government will allow this to carry on much longer."
If the Shanxi government did contribute funds to bail out trust investors, it would mark the latest case in which a local government intervened to prevent default, including by non-state owned firms.
A Shanghai district government intervened in January last year to prevent a bond default by Shanghai Chaori Solar Energy Science and Technology Co..
In July 2012, a local government in Jiangxi province announced it would use taxpayer funds to repay the trust loans of LDK Solar, a U.S.-listed solar equipment manufacturer.
In April 2012, a municipal government in Shandong province appeared to step in to prevent default by Shandong Helon Co. Ltd., a textile firm. ($1 = 6.0488 Chinese yuan)
(Reporting by Gabriel Wildau; Editing by Simon Cameron-Moore)