The governor of the city of Yongqiu, Linghu Chao (令狐潮), agreed with the surrender after the fall of Luoyang, which in his view made the Tang cause hopeless.
At around this point, the magistrate of Danfu Jia Bi (賈賁) led an army of around 2,000 men to besiege the weakly-defended Yongqiu, which was an outlying fortress of Suiyang essential to its long-term security.
To Jia Bi's luck, these prisoners were able to escape (probably with the help of civilians or other uncaptured loyal soldiers), and caused massive chaos within the fortress.
Zhang Xun refused to follow Yang Wanshí's surrender orders, and instead gathered around 1,000 elites among several thousand citizens and soldiers to join up with Jia Bi, after leading his retinue in a tearful worship of the Tang Emperor's ancestor.
Zhang Xun then reported the battle situation to Li Zhi, Prince of Wu, stationed in Pengcheng (now Xuzhou, Jiangsu).
In March, Linghu Chao, together with rebel generals Li Huaixin, Yang Chaozong and Xie Yuanshang, returned to besiege Yongqiu with 40,000 troops.
The rebel army had no other choice but to launch a frontal assault, climbing up the city walls with siege ladders.
He augmented the effect of these maneuvers by ordered his troops to play war drums during night time, which forced the rebels to prepare for battle.
Zhang Xun flatly refused and took the opportunity to shame Linghu Chao, saying, "In ancient times, when a father died for the emperor, he did not report it.
At this time, Linghu Chao had been besieging Zhang Xun in Yongqiu for more than 40 days, and they had lost contact with the court.
When Linghu Chao learned that Chang'an had fallen and Emperor Xuanzong had fled to Shu (modern day Sichuan), he wrote a letter to Zhang Xun, trying to persuade him to surrender again.
Among the defending generals, there were six who thought that the situation was hopeless and the fate of Xuanzong was unknown, and advised Zhang Xun to surrender.
Zhang Xun then brought the six generals to the front of the hall, blamed them for their lack of loyalty, and beheaded them, further strengthening the army's determination to defend the city.
Food was scarce, but the rebel army's hundreds of ships carrying salt and rice were about to arrive at the front line.
However, Zhang Xun sent brave soldiers to the river, seized the rebel army's salt and rice, burned the rest, and then safely returned to the city.
Linghu Chao noticed a number of black figures in the distance, and ordered his archers to shoot at them, hoping to stop the attack.
When the scarecrows got pulled back over the wall, along with numerous embedded arrows, Linghu Chao realized that he had been deceived.
Zhang Xun immediately ordered his troops and civilians to tear down the huts and tents and surroundings houses, and bring the lumber back into the fortress.
When Zhang Xun returned to Taoling (now southeast of Grains County, Henan), he encountered more than 400 rebel reinforcements and captured them all.
Zhang Xun separated the captured rebels, killing all the Hu people from the states of Gui and Tan, and released the coerced soldiers from Yingyang and Chenliu, allowing them to return to their homes.
Linghu Chao first sent four envoys into the city to persuade them to surrender, but Zhang Xun executed them all and then sent their followers to Li Zhi, his nominal superior.
In August, the famous Yan general Li Tingwang (李庭望) led an army of 20,000 to besiege Yongqiu.
Henan Jiedushi Li Ju retreated his troops east to Linhuai, while rebel general named Yang Chaozong (楊朝宗) led 20,000 rebels to the south of Yongqiu, to attack Ningling (寧陵) (in modern-day Henan) and cut off Zhang Xun's retreat route.
On the same day, Yang Chaozong led his troops to the northwest of Ningling, and Zhang Xun and Xu Yuan sent generals Lei Wanchun and Nan Gaiyun to meet the enemy.
Emperor Suzong sent an edict appointing Zhang Xun as the deputy governor of Henan, commanding the war in the Jianghuai area.
Zhang Xun believed that his soldiers had made great contributions, so he sent envoys to Guo Wang Li Ju to request blank appointments and rewards, but Li Ju only gave thirty appointments for Zhezhong Duda and Guoyi Duda, without any rewards.
Zhang Xun wrote a letter blaming Li Ju, saying, "The imperial court is still in danger, and I am defending a lonely city outside.
The rebel general Shi Siming retook the counties of Hebei, then besieged the isolated city of Taiyuan, intending to capture Hedong and then take the areas of Peifang, Hexi, and Longyou.
An Qingxu appointed Yi Ziqi (尹子奇) as the governor of Henan and led his troops to attack Suiyang, intending to penetrate towards the Yangtze River and seize the region's financial resources.