Thai Premier Prayut Chan-o-cha will land in Xiamen today as the only guest from South-east Asia and East Asia at this year's summit of leaders from some of the world's largest emerging economies. At the invitation of China, he will take part in a dialogue attended by leaders from Brazil, Russia, India, China and South Africa (Brics).
On the same trip, China and Thailand will ink two contracts kicking off work on a much delayed high-speed railway that will connect the two countries via Laos.
Analysts see the invite as a reward for the rail project, but warn that domestic opinion in Thailand could still derail Beijing's ambition to link up the region, and cool warming Sino-Thai relations.
Thailand has leaned on China since the 2014 military coup, when Western democracies dialled down exchanges with the kingdom. Both countries held their first joint air force exercises in 2015. Earlier this year, Thailand committed to buying the first of three submarines from China, in a deal expected to deepen military ties.
But it was rail that proved the biggest challenge to bilateral ties. Thailand is a key node in Beijing's "Belt and Road" vision of infrastructure networks linking its hinterland to the economies of mainland South-east Asia. The US$6 billion (S$8.2 billion) high-speed railway linking southern Yunnan with Laos would not be viable if it did not go on to Malaysia via Thailand.
Like the previous administration, Thailand's military government sought Chinese involvement for this rail link, but wrangled over the financial terms. Last March, General Prayut announced Thailand would pay for the first 250km of the more than 800km-long network. Still, work was held up by legal hurdles, like one requiring Chinese engineers involved to be certified in Thailand.
Beijing did not invite Gen Prayut to its Belt and Road forum in May. He was among three Asean leaders - with Singapore Prime Minister Lee Hsien Loong and Brunei Sultan Hassanal Bolkiah - not on the guest list. "It was just to send a signal that the Chinese were not happy," University of Queensland lecturer Patrick Jory tells The Straits Times.
In June, Gen Prayut invoked a special constitutional clause to clear legal hurdles for Chinese involvement in the railway.
ISEAS - Yusof Ishak Institute visiting fellow Pongphisoot Busbarat says: "The invitation to attend the Brics summit shows China's goodwill towards Thailand as one of its close friends in Asia.
"But it is likely to be more a diplomatic showcase."
Thailand, which posted a better-than-expected 3.7 per cent economic growth in the April to June quarter, remains a treaty ally of the United States and receives the largest amount of foreign investment from Japan. While it has long enjoyed close cultural and commercial ties with China, analysts say this special relationship is not guaranteed.
Other Asean states are moving into Beijing's orbit. For example, Malaysia and Indonesia are starting rail projects with Chinese loans.
Domestic opinion in Thailand is another significant factor in Sino-Thai ties, says US-based Stimson Centre senior associate Yun Sun. Gen Prayut's fast-tracking of the rail project has raised some objection. China's interests would be affected should domestic opposition derail it, she says.
Meanwhile, Dr Pongphisoot says, the assertiveness of China's foreign policy and its "shaming" of countries it is displeased with - as seen in the Belt and Road forum - could "dilute the Thai elite's positive perception towards China".