Optomechanics under thermal gradients