The result means that with three games to play – against the Dragons, Scarlets and Leinster – the Blues are one point behind the Ospreys in third place and are a game behind the league leaders Leinster, who are two points ahead of them.
The Blues made a great start with early tries from Luveitasau and Shanklin but the Borders, who are set to go out of existence at the end of the season, hit back with tries from Kelly Brown and Gregor Townsend to storm into a 14-12 lead.
The visitors composed themselves and ensured the bonus point before the break with further tries from Shanklin and Luveitasau. There were three more tries after the break – two from the lively Shellard and a penalty try – to keep the Blues in the title chase.