Kepu becomes only the fifth Wallabies player to be sent from the the field and the first since Kuridrani was dismissed for a lifting tackle against Ireland in 2013.
Scotland immediately made their numerical advantage tell when halfback Ali Price wrong-footed Bernard Foley and darted over from close range with Finn Russell adding the extras to give his side a 17-12 lead at the break.
Kurtley Beale restored Australia's lead after the restart with an excellent dummy that fooled the Scots' defence allowing him to crash over.
However, four tries in a dazzling 15-minute spell sent the home crowd into a frenzy as Scotland, led by fill-in fullback Sean Maitland, a late replacement for Stuart Hogg who was injured in the warm-up.
Maitland grabbed the first after rampaging down the left flank with Jonny Gray and lock Huw Jones crossing before winger Byron McGuigan added to his first-half opener to leave the Wallabies shellshocked.
Retiring former skipper Stephen Moore was given a warm reception from the Murrayfield crowd when he exited the field for the last time just before the hour mark before Lopeti Timani added some respectability to the score with a close-range five-pointer that was converted by Foley.
But the misery continued for Cheika, whose side finished with 13 men after Kurtley Beale was sin-binned, with skipper John Barclay and Stuart McInally going over to bring up the half-century for Scotland.
The Scots' previous biggest win against Australia was 24-15 in 1981.