Khmelnytsky uprising
Wiśniowiecki fought against the Cossacks again during the Khmelnytsky Uprising in 1648–51. At the time of the outbreak of the revolt he was staying in Lubny, and he began mobilizing his troops after receiving information about the growing unrest. In early May the prince learned about the Cossack victory at the Battle of Zhovti Vody. Receiving no orders from Hetmans Mikołaj Potocki and Marcin Kalinowski, he began moving on his own, soon learning about the second Cossack victory at Battle of Korsuń, which meant that his troops (about 6,000 strong) were the only Polish forces in Transdnieper at that moment. After taking in the situation, he began retreating towards Chernihiv; his army soon became a focal point for various refugees. Passing Chernihiv, he continued through Liubech to Brahin.
A sworn enemy of the rebels, whom he called "ungrateful rabble", in Liubech Yarema publicly declared that it would be better to die than to live under the rule of "pagans and idlers". He continued to Mazyr, Zhytomir, and Pohrebyshche, stopping briefly in Zhytomir for the local sejmik. On his way across the region, Wiśniowiecki's troops left a trail of destruction, exacting vengeance on perceived rebel supporters for the murder of Poles and Jews during the uprising. During Wiśniowiecki's campaign, people suspected of sympathy to the Cossack insurgents were put on stakes, hanged, beheaded, blinded and had their arms cut off. After some skirmishes near Nemyriv, Makhnivka and Starokostiantyniv (Battle of Starokostiantyniv) against the Cossack forces, by July he arrived near Zbarazh, where the Crown Army was gathering at the time.
Wiśniowiecki's fighting retreat had a major impact on the course of the war. In the words of the historian Władysław Konopczyński, "he was neither defeated, nor victorious, and thus he made the peace more difficult." Politicians in Warsaw tried to negotiate with the Cossacks, who in turn used Wiśniowiecki's actions as an excuse to delay any serious negotiations.
Around late August or early September, Wiśniowiecki met with the army commanders (regimentarze) Władysław Dominik Zasławski-Ostrogski, Mikołaj Ostroróg and Aleksander Koniecpolski. He was not on overly friendly terms with them, as he resented being passed over in military nominations, but after short negotiations, he agreed to follow their orders. Though he was thus reduced to the status of a junior commander, this had little impact on the next phase of the campaign. On 23 September, their forces were, however, defeated at the Battle of Pyliavtsi; near the end of the battle some accounts suggest Wiśniowiecki was offered the hetman's position, but refused. On 29 September in Lviv, the surviving commanders and remnants of the Polish forces from the Battle of Pyliavtsi elected Jeremi Wiśniowiecki as field regimentarz, with Mikołaj Ostroróg appointed as his deputy. At that time, approximately 4,400–6,000 armed men remained under their command, while a much larger number of inhabitants and refugees gradually left the city.
A decision was made to organize the defence of Lviv through an emergency collection of funds, which soon brought in around 900,000 zlotys along with a large quantity of valuables. However, following reports of the approaching forces of Bohdan Khmelnytsky, Wiśniowiecki and Ostroróg, together with part of the accompanying group, secretly left the city on 5 October, taking the entire collected funds with them. Responsibility for the defence of Lviv was transferred to the burgomaster Marcin Grosweyer. Amidst the siege of Zamość, the Sejm appointed Wiśniowiecki temporary commander of the pospolite ruszenie. In the end, the cities were not captured by the Cossacks, who in the light of the coming winter decided to retreat, after being paid a ransom by both town councils; no other large field battle took place that year.
Meanwhile, the convocation sejm of 1648 had elected a new king, Jan Kazimierz II Vasa. Wiśniowiecki supported other candidates, such as George I Rákóczi and Karol Ferdynand Vasa (Jan Kazimierz's brother). Due to the opposition from Jeremi's detractors, he was not made a hetman, although after a full two days of debate on the subject he was granted a document that stated he had a "power equal to that of a hetman." Wiśniowiecki's faction, arguing for an increase in army size, was once again marginalized by the faction that hoped for a peaceful resolution. In the end, the King and most of the szlachta were lulled into a false sense of security, and the military was not reinforced significantly. In addition, the coronation sejm of January–February 1649, held in Kraków, revoked Wiśniowiecki's regimentarz rank.
In the first half of 1649, the negotiations with the Cossacks fell through, and the Polish–Lithuanian military began gathering near the borders with Ukraine. A major camp was in Zbarazh, where Wiśniowiecki would arrive as well in late June, after gathering a new army of 3,000 in Wiśnicz, which was all he was able to afford at that time, due to most of his estates being overrun by the Cossacks. Wiśniowiecki's arrival raised the morale of the royal army, and despite having no official rank, both the common soldiers and the new regimentarz promised to take his advice and even offered him the official command (which he refused). During the siege of Zbarazh, Wiśniowiecki was thus not the official commander (role was taken by regimentarz Andrzej Firlej) but most historians agree he was the de facto commander of the Polish–Lithuanian army. The siege would last until the ceasefire of the Treaty of Zboriv. Wiśniowiecki's command during the siege was seen as phenomenal, and his popularity among the troops and nobility rose again; however, the King, still not fond of him, gave him a relatively small reward (the Starostwo of Przasnysz, much less compared to several others he distributed around that time). Needing Wiśniowiecki's support in December that year, the King granted him once again a temporary hetman nomination, and several more land grants. In April 1650, Wiśniowiecki had to return his temporary hetman office to Mikołaj Potocki, recently released from Cossack's captivity. During December that year, in light of the growing tensions with Muscovy, Wiśniowiecki's military faction succeeded in convincing the Sejm to pass a resolution increasing the size of the army to 51,000, the largest army since the Cossack unrest began two years earlier.
The truce of Zboriv did not last long, and in the spring of 1651 Khmelnytsky's Cossacks began advancing west again. On 1 June 1651 Wiśniowiecki brought his private army to face the Cossacks in Sokal. He commanded the left wing of the Polish–Lithuanian army in the victorious Battle of Berestechko on 28–30 June . The Polish–Lithuanian army advanced after the retreating Cossacks, but on 17 July the King "left the whole army to Potocki ... and having given the order that the army march into Ukraine, the King himself parted ... to Warsaw to celebrate his victories over the Cossacks." Later that year, on 14 August, Wiśniowiecki suddenly fell ill while in a camp near the village of Pawołocz, and died on 20 August 1651, at the age of only 39. His cause of death was never known, while some (even contemporaries) speculated he was poisoned, but no conclusive evidence to support such a claim have ever been found. Based on sparse descriptions of his illness and subsequent investigations, some medical historians suggest the cause of death might have been a disease related to cholera. However, one account states, "following a cheerful conversation with other officers who had congregated for a military council in his tent on Sunday 13 August N.S. he had eaten some cucumbers with zest and washed them down with mead, and from that contracted dysentery. After lying ill for a week, he died there, at Pavoloch". He was given a "ceremonial funeral with the entire army present. On 22 August Wiśniowiecki's body was seen off with the utmost pomp on its journey to his residence".
Wiśniowiecki's indebted family was not able to provide him with a funeral his rank and fame deserved. In the end, he never received the large funeral and the temporary location of his body, the monastery of the Holy Cross at Łysa Góra, became his final resting place. His body was believed lost in a fire at the end of the 18th century, which would prevent a modern reexamination of the cause of his death, although a body purported to be his had been discovered by Oblates in 1936. In the interwar period, the authenticity was questioned by the magnate's biographer, Władysław Tomkiewicz, who argued that the body had been burned in a fire in 1777. Forensic examination in 1980 showed that the body belonged to another person, who was taller and died at a more advanced age than Wiśniowiecki. No traces of the autopsy performed in the 17th century were found; however, it is likely that this person lived in the same historical period and their corpse was kept on display in the monastery as Wiśniowiecki.