It's a good thing you're here.
vs
It's the good thing you're here.
Giving to these sentences their simple form simplifies the argument. The focusing through the cleft sentence structure only makes more obscure the ideas involved and hinders reasoning because of the lack of idiomaticity that can be felt.
A good thing is that you are here.
The good thing is that you are here.
The reason the first form is correct whereas the second does not appear to represent reality is simply found in the grammatical theory of the use of articles. However, it is not that simple. There is a notion of correction only as regards to a particular context, and that is so in both cases; the second sentence is not necessarily wrong, it will take a more involved context to justify it but it is perfectly grammatical.
"The" is reckoned with as a definite article, that is to say that it makes possible to refer to a particular thing; on the other hand the indefinite article "a" does not do that. Grammarians (CoGEL) say that the sentence in "(a)" below has indefinite reference, whereas that in "(b)" has definite reference.
- Have you seen a bicycle? (a) (example from CoGEL)
- have you seen the bicycle? (b) ( " )
If we were to use the definite article, there would have to be in the context a given good thing to which we refer, something well enough determined so that it can be identified, and the use of "the" would point to it, identify it (in other words); the sentence is meant to characterize "that you are here"; what is "your presence here" (= that you are here")? It is a thing, a good thing, that is one indeterminate good thing among all the good things. We'll say then that since that good thing is "your presence here", then it is not indefinite, it is well determined, and that sounds like a contradiction; nevertheless, there is no contradiction¹ as the copular relation makes abstraction of any indefinite referential implications for the indefinite article; the use of the indefinite article is in that exceptional case, not referential but defining.
¹I have no reference for that, it is my own theory about the matter, as no grammar has, as yet, shown me that. It is worth mentioning, though, if for nothing else than a possible refutation.
A good thing is your presence here. (function of indefinite reference of "a" - All good things are your presence here, if something is a good thing, it must be your presence here, and so, there exists exactly one good thing, which has to be your presence here; that is nonsense.)
Your presence here is a good thing. (function of "a" as indicator of a defining relation - This copular relation defines "your presence here" as a good thing through the use of the defining article, in other words as an element in the set of good things.)
Context in which the definite determiner becomes natural
— Some days ago, John spoke to us of a good thing that would take us out of the bind we are in now, but he remained mysterious, telling us that we would know soon enough; this morning, before your arrival, he finally let me know; do you know what, the good thing is that you are here.
Your presence here is the good thing. (In this case, the inversion causes no nonsense, and the meaning is the same.)
The good thing is your presence here.
Addition so as to try to make the point clearer
From the equivalence I use, that is, « "noun phrase 'your presence here'" equivalent to "nominal clause 'that you are here'" », there is nothing more to get than the fact that this nominal clause represents the name of something, the fact that you have to consider it fundamentally as a noun (even though you can't treat it fully as a noun—for instance, you can't append articles to it).
Perhaps you haven't grasped what I think is different in the case of a copular relation ("be" instead of other verbs); I'll try another approach. If you say "a car covers many miles quickly", then it is the same as saying "all cars cover many miles quickly", but if you say "a good thing is your presence here" saying "all good things are your presence here" does not amount to the same idea; in fact it is nonsense. I infer from that difference that "a" takes on a different semantic function, it is not used to refer to an indefinite element (any car) but to define one element (your presence here) since there is nothing indefinite about that thing called "your presence here"; in other words, the copula presents a particular element of the set of good things through the use of "a"; symbolically, instead of saying "if x is in A then x does K" (x is a variable), you say "X belongs to A" (X is not a variable but a fixed element in A); so to speak, X is being defined.
Second addition in answer to the comments (PART 1, PART 2, PART 3)
Your initial sentence (post of the question) is of a particular type; it corresponds to a simpler sentence in which occurs what is called fronting. The inversion is quite common both in colloquial speech and in conventional written material (CoGEL); it aims at giving prominence to the fronted element.
- That you are here is a good thing. (usual order) → A good thing is that you are here. (fronting)
Your initial sentence goes one step further as it is conceived to give even more prominence to the utterance; it is called a cleft sentence because from a usual one-verb sentence (That you are here is a good thing.) is made a sentence with two verbs that has the very same meaning (It is a good thing that you are here.).
So, technically, we can say that, but only in most cases; there is no problem for making adverbials and objects (direct and indirect) the focus, however, there are severe restrictions for making the subject complement the focus (except in colloquial Irish English) (CoGEL), especially when the verb "be" is at the end and when the subject complement is realized by an adjective phrase (CoGEL). Otherwise, without those restrictions, the subject complement can be acceptable as the focused part.
(The interrogation point means that the native speaker is unsure whether this is acceptable or not)
- ?It's a genius that he is.
- ?It's a lecturer that I am now.
- ?It's very tall you are.
Here is for instance a case that figures in § 18.29 of the CoGEL.
- It's a good rest that you need most.
- A good rest is what you need most.
So, why not "A good thing is that you are here."?
"The fact that you're here is a good thing." is nothing more than an additional construction with similar semantic properties, this new type being called a pseudo cleft sentence because the particular device used is not an impersonal it-construction but the introduction of a generic term for the subject complement. However, your apparent understanding that the pseudo-cleft construction renders nul the possibility of a proof is, I think, something important. It shows that neither my initial argument nor my alternative approach are valid; in the argument there is a lumping together of indefinite reference and generic reference: that is nonsense since specific indefinite is not "general"; as to the alternative approach, in the first sentence "a" contributes to a generic reference whereas in the second it does not. A generic reference implemented through "a" only comes through as such to the reader by virtu of the nature of the complement. Consider the following, where the complement is not "your presence here" but "only a conception of the mind".
- A good thing is only a conception of the mind
Now there is no problem and "all" can be used, thus verifying a use of the article with generic reference; so, it is not the case that we can't use that form but only that an assumption of generic reference is completely wrong (truly irrational). Getting back to the sentence and using the last form you choose (The fact that you're here is a good thing) or another one similar to it, my conclusion is still that the copular relation does not materialize any of the known references (indefinite, generic) and that it is used to define a term (through the use of the copula); however, I am not aware of any way as pungent as those I used wrongly that would show that (sorry for sidetracking you twice in such an awful way, also, thank you for your patience). One argument that can be made is that this good thing is not indefinite since it is known to be, among all good things, that particular one called "your presence here".
Yes, "one" can be used informally as a replacement of "a" ("an"), especially NAmE. (OALD, 8)
The fact that the semantic idea of indefinite reference is not really relevant changes nothing, everything remains valid; our failure to identify the nature of the relation properly as defining (if that is really the case) does not impair the intuitive understanding that internalization has constructed in our unconscious mind. Therefore, as I said above for other reasons, the inversions remain legitimate.
No, in fact, the statement in which "a" is used is the only one for which I can see a context. I can't fit the other one (that is, exactly as it is) to any context.
The use of "the" (in the sentences about the trip to Greece) is not familiar to me; what I would expect instead is "the good thing about it"; possibly, the former is a shortening of the latter. The explanation of this use of "the", in either case, is unknown to me; however, as the use of the long form is correct in this context, so must be that of the short one. There is no case of definition either before or after in the context, and I can't identify what could be the particular case of "larger situation" (general knowledge) ("implied" as you say).
What should be the final word on this question
I finally hit upon a section of CoGEL that confirms my understanding; it is a section I had never paid enough attention to.
(CoGEL § 5.37) Nonreferring uses of the indefinite article
The indefinite article is strongly associated with the complement function in a clause, or more generally with noun phrases in a copular relationship. Here it has a descriptive role (similar to that of predicative adjectives), rather than a referring role:
- Paganini was a great violinist.
- My daughter is training as a radiologist.
- We found Lisbon (to be) a delightful city.
- What a miserable day (it is)!
Whereas the indefinite article is required in the previous examples, there is vacillation in the following cases:
- her duties as (a) hostess
- my appointment as (a) lecturer
- Jung as (a) thinker
Sometimes a/an is nonreferring in a stronger sense; it may not refer to
anything in reality at all:
- Leonard wants to marry a princess who speaks five languages.
From this sentence, we cannot tell whether Leonard knows a certain princess
and wants to marry her, or whether he has simply laid down exceptionally
stringent qualifications for his future wife. For all we know, there may be no princess who speaks five languages in existence.
Note
Although a/an is used for descriptive exclamations such as What a fool (he is)!, there is also an exclamatory use of the in The fool!, The silly boy!*, etc. Such expressions often accompany a declarative clause, and are added as a parenthesis (intonation remaining at a low pitch):
John is getting into DÈBT, the idiot!
My DÀUGHTER| the little DÀRLING| has broken the T`V|< ironic >
There is a related type of descriptive exclamation in which a noun phrase with the or zero article is followed by that and a subject and verb (normally be):
(The) fool that he is!
[…]