It sounds pretty harsh, but the rough answer to your question is: It's **always** in the second position, with some exceptions.

Yes, it's an hyperbole. But the truth is that the verb is more often in second position than not. So, the question had to be: when is it not in the second position? And the popular examples are: questions, imperative and subordinate clauses.

Now, let's get to your example. Beforehand, you can find a very thorough answer by browsing on canoo.net. Once you understood the idea of [Stellungsfelder][1] and the [Vorfeld][2], you will fully comprehend it.

In your example, the subordinate clause [takes the position of the Vorfeld][3]. That means that the whole subordinate clause takes the first position. Hence, the verb is in the second position if it comes immediately after the comma.

What you really need to remember is:

* If the main clause comes first, subject comes before the predicate.
* If the sub clause comes first, subject and predicate are swapped.

That all being said, there's also another view at it. You can also consider it one of the exceptions where [the verb comes in first position][4].




  [1]: http://www.canoo.net/services/OnlineGrammar/Satz/Wortstellung/Stellungsfeld/index.html?lang=en
  [2]: http://www.canoo.net/services/OnlineGrammar/Satz/Wortstellung/Stellungsfeld/Vorfeld.html?lang=en
  [3]: http://www.canoo.net/services/OnlineGrammar/Satz/Wortstellung/Stellungsfeld/Vorfeld.html?lang=en#Anchor-Nebensatz-47857
  [4]: http://www.canoo.net/services/OnlineGrammar/Satz/Wortstellung/Stellungstyp.html#Anchor-Der-47857