Edinburgh prevail in Murrayfield thriller