All of the above mean the same thing and are more or less correct. The first option is a little awkward, possibly just because of usage: the other two options are more commonplace, so the first one looks odd. It would work better if phrased more directly:
You did a good thing when you taught me how to play guitar.
That sounds natural, but also reads as a bit strong. The other two are more indirect and casual, and I would say the final sentence, It's a good thing you did, teaching me how to play guitar, is the best, as the comma separates the two phrases.
Good to be aware: the sentence structure there comes off as pretty informal. It would sound natural if spoken aloud or written in a text message—something you'd say to thank a friend or peer. But it might be too casual for formal writing. In that case, I would go with the "You did a good thing when..." sentence. It is the clearest and most direct, which is typically the standard for formal English style.
A deeper investigation of usage:
Breaking down the sentence, you have three parts:
(It is a good thing) ([that] you did) (teaching me to play guitar)
As I mentioned before, those first two parts can be worded You did a good thing to be more direct—at the possible cost of putting more stress and attention on the person you're speaking to.
The final part of the sentence is a gerund phrase that has also been moved out of place. Its 'proper' location is actually being taken up by the pronoun it of it's a good thing you did, meaning that a simpler version of the sentence would read:
Teaching me to play guitar is a good thing you did.
That, however, sounds extremely stilted. Typically, the 'point' of a sentence goes at its end, and the sentence above looks less like someone thanking another for a guitar lesson and more like the analysis of a good-thing-identifying robot.