Quantum optomechanics opens a possibility to mediate a physical connection of quantum optics and classical thermodynamics. We propose and theoretically analyze a one-way chain starting from various quantum states of radiation. In the chain, the radiation state is first ideally swapped to sufficiently large mechanical oscillator (membrane). Then the membrane mechanically pushes a classical almost mass-less piston, which is pressing a gas in a small container. As a result we observe strongly nonlinear and nonmonotonic transfer of the energy stored in classical and quantum uncertainty of radiation to mechanical work. The amount of work and even its sign depends strongly on the uncertainty of the radiation state. Our theoretical prediction would stimulate an experimental proposals for such optomechanical connection to thermodynamics.