Gujarat Titans pulled off a thrilling last-ball win in the IPL, after needing 35 runs from 12 deliveries to beat Rajasthan Royals.