How should my third-generation Nest thermostat be connected?
Based on this wiring diagram, this looks like a multistage heat pump thermostat (provide control of a two-stage heating/one-stage cooling heat pump system). 

From left to right in your picture:


W2 = Aux. Ht. Relay
G = Fan Relay
R = Power
X = (Note says terminal labeled C/X on some models, and based on
diagram, I think your assumption of common wire is correct)
E = Em. Ht. Relay
Y = Compressor Contractor
O = Cool Changeover Valve


Based on those wires, and this wiring from the Nest Pro Installer Guide, I think you'll wire it as a 1 Stage Heat Pump with Aux heat and Emergency Heat



So if we link up your current wiring to Nest:


W2 -> W2/Aux (Auxiliary Heat Relay)
G -> G (Fan Relay)
R -> Rc (24VAC power)
X -> C (24VAC Common Wire)
E -> * (Star: E)
Y -> Y1 (Compressor Relay (Stage 1))
O -> O/B (Heat Pump Changeover Valve)