Given that the input filter capacitor(s) will probably determine the useful life of this gadget, consider how much you want to compromise for small size.
You really have two things to play with (I'm going to assume you've got 50Hz input, the answers are not much different for 60Hz)- you can have more ripple voltage (which makes the SMPS work harder and tends to heat the capacitor more or you can have more capacitance (which makes the capacitor bigger).
So let's just say you can live with 5V of ripple peak-to-peak. Your current at 31V or so will be around 300mA assuming 85% efficiency. So with a full-wave rectifier, C ~= 600uF. Let's try around 470uF to 1000uF. Ceramic assemblies meet your height requirement, almost, at 5.5mm, but you'd need 5 pieces at $36 each to get to 500uF. Kinda expensive. 22uF 0805 you'd need maybe 25 of them at 0.65 each (about $16) but a lot of area (maybe you could fill the bottom of the board with them). Very thin.
At 500uF, ripple will be about 11V p-p, still possibly tolerable with ceramic caps.
Polymer SMT caps are more like 11mm high, so forget those.
As to regular electrolytics, you could cut away the board to allow the capacitor to protrude through- gaining maybe 2-3mm that way, so a 7-8 mm diameter cap might be as acceptable as a 5mm tall SMT part. Perhaps one or two of these parts might do you EEU-FR1V471LB. 0.20 each in 1K quantity, so cheap, and 8mm diameter, and they're 105°C 9000h so pretty reliable.