Emotions are recognized as strong modulators of cognitive capacities. However, studies have mainly focused on the effect of negative emotions, with few investigating positive emotions. Recent studies suggest that traits of personality can modulate the effects of emotion on cognitive performance. This study aimed to assess whether emotional states differing according to their valence influenced the ability to achieve instrumental conditioning and learning flexibility and to determine the influence of personality. After being tested for their personality, 55 mares underwent acquisition and extinction procedures of instrumental conditioning in a box previously associated with negative events (e.g., novel and sudden stimuli; E-), positive events (e.g., food reward; E+), or no particular event (E0). This contextual conditioning induced contrasting behavioral and physiological responses during acquisition, indicating that E- horses were in a negative and E+ horses were in a positive emotional state. Although acquisition performance did not differ between groups, E+ horses showed a greater flexibility in the extinction phase of instrumental learning than E- and E0 horses. Furthermore, fearless personality was related to better acquisition and increased cognitive flexibility. This study demonstrates that horses were able to undergo contextual conditioning that induced negative or more positive emotional states and that this latter emotional state enhanced cognitive flexibility.