Think you've got this wrong. The Soviet Union didn't invade Japan from the North, they declared war, and invaded Japanese held China (in particular, Manchuria). Though it did affect the Japanese decision to surrender.
The japanese did surrender conditionally, but it wasn't like it was them that were offering conditions to the US for months. The conditions argument was in the main between the US and the UK (US wanted Hirohito tried as war criminal, UK wanted to keep him as head of state). UK, US and China agreed conditions which they would accept a Japanese surrender, a week or 2 before the first bomb.
The decision was taken on the 9th of August - the day in which they got news of Manchuria and Nagasaki. So I don't know where you get that they "didn't surrender after the second one". They did. It might not have been the only factor, the USSR invasion helped, but it's unlikely a USSR invasion on it's own would have triggered the surrender.
Also, there was going to be a 3rd bomb available a week after the 2nd one was dropped. But it was likely if Japan hadn't surrendered by then, the US would have "saved up" a lot of bombs for a nuclear blitz, and force the end of the war that way.