Q:

I want to know when to able to grammatically omit "that" leading an appositive clause

She had a feeling (that) this would be the last time

Back in my school, I learnt not to omit "that' when it's leading an appositive clause as in the example, but I've just heard that with or without "that" , the sentence sounds natural.
So, I want to know when to able to grammatically omit "that" or not in this case.

A:

As user178049 says in a comment, "that this would be the last time" is functioning as the complement of "feeling" (just as it could function as the object of the verb "feel") and "that" is optional in this construction. 
It is a different construction from 

She had a feeling [that] she recognised.

where the "that" clause is a modifier (adjunct, appositive if you will) to "feeling". "That" could also be omitted in this case, because the head of the relative clause ("feeling") is not its subject. 
(My example is ambiguous until you get to the end, and find no object for "recognised", and realise it must be a relative clause. It's a "garden path sentence").
"She had a feeling that surprised her" is another with a relative clause, but here the "that" cannot be omitted in standard English, because the head of the relative clause (the feeling) is its subject. 

