Petting a horse makes it SUPERHAPPY.

A horse remains SUPERHAPPY until...
- ...the 10 minute timer runs out (hover your mouse over the heart icon to see), the horse turns HAPPY
- ...you feed it no treat (by clicking "skip" in the treat pop-up), the horse turns UNHAPPY
- ...the horse returns from an action, the horse turns HAPPY

Buying the treat(s) the horse wants within the treat pop-up even makes a HAPPY horse SUPERHAPPY.

A horse ages when doing an action - independent from the happy state.
A horse levels when reaching a certain age - independent from the happy state.

A horse only gains progress from doing training actions when it is SUPERHAPPY.
SUPERHAPPY horses have a higher chance of winning competitions.
SUPERHAPPY horses have a higher chance of scoring EXCELLENT when doing an action - resulting in higher revenue and a higher chance to find a collectible.