Have the Venetian Republic survive dismemberment by the French and Austrians in 1797. The Republic delines in importance and shrinks over the years till only Venice, Trieste and Treviso and a thin strip of coastline between the three remains. The French, Venetians and the Russians sign a treaty in 1860 that guarantees the existence of the shrunken Republic (Now renamed the Marano Republic) with Basing rights for the French Navy in the Venice Lagoon and a major naval base for a Russian Mediteranean Fleet in Trieste with the joint intention of keeping the Austrians from dominating the Adriatic and Italy, also to prevent the Royal Navy dominating the Eastern and Central Mediteranean from its bases in Malta and Alexandria.
This treaty survives till 1915 when the French offer to transfer its Ventian basing rights to Italian control in exchange for Italy joining the Entente.
Early in 1918 the Austrians realising the Axis is doomed secretly agree to turn their backs on the Germans and pull out of the war and dismantle the Empire peacefully keeping all German speaking regions of the old Empire inside Austria. The reward will be no onerous post war treaty and access for Austria to the sea at the Free Port of Falkenberg (Montfalcone). The Versaille Treaty guarantees the rights of the Marano Republic and removes the Rusian rights to its Naval base in Trieste. A Democratic constitution is put in place removing the power of the Doge of Venice. A new Capital is sited in Trieste and the new President is called the Doge of Marano in deference to history
In 1940 Mussolini forces the tiny Republic to join Italy in a wartime ailiance. Postwar Marano was occupied jointly by the British and French who fought a long campaign against Tito backed Communist guerillas till 1952 when a treaty was signed with Yugoslavia. Marano regained independence in 1954 joining NATO in 1955 and the EEC in 1963. Today the Tiny Republic of 1.2 million people is a thriving trading nation at the heart of the European Union still using the ancient winged Lion emblem of Venice on its flag.
Not a free Trieste but the closest I could come up with.