The 25-year-old, who has been capped once by Scotland, looked set to quit Saints at the end of last season and move south to England.
But with no acceptable offers materialising, he has opted to sign a new one-year deal with the club.
Manager Tommy Wright said: "It's great news for the club. It's no secret that Murray had indicated that he wanted to play in England and I can fully understand why, but he was always in touch with the chairman and I over the summer and he told us that if nothing came his way down south then Saints were the only team in Scotland he would sign for.
"He put pen to paper yesterday morning before the Europa League game and it's great to have him back."