The Ladbrokes Championship leaders, who claimed this trophy in 2006/07 and 2010/11, came out on top in front of 3,057 fans at the Caledonian Stadium in Inverness.
The Welsh club were deservedly ahead at the break thanks to a superb strike from Michael Bakare and missed other good chances but the Staggies responded in the second half.
Substitute and man of the match Josh Mullin equalised from a tight angle with 15 minutes left and the former Livingston player scored again before Jamie Lindsay rounded things off for Steven Ferguson and Stuart Kettlewell's team four minutes from time.