Why didn't you argue with him?
1-Are you kidding? It was a gun on the table.
2-Are you kidding? That was a gun on the table.
Are "1" and "2" both acceptable as a reply to the original sentence?
If we look at your examples from a strictly structural view, a wonderful pattern emerges.
First, if we interpret 'It' as a pronoun meaning, say, 'That thing we saw', then sentence 1- works (given Tdol's suggested context):
1- It (That thing we saw) was a gun on the table.
On the other hand, if we interpret 'It' as an expletive, the sentence reads awkward because the phrase 'on the table' is interpreted as part of the semantic subject (i.), but it is not. It is an adverbial complement (ii.), structurally separate from the noun it modifies, and as such requires a pronoun with adverbial properties, which is why 'There' is used (iv.):
i. It was a gun on the table. :cross: expletive
ii. A gun was on the table.
iii. There is a gun on the table.
I see a similar pattern in your second example:
2. That was a gun on the table.
i. That was a gun.
ii. That (there) was a gun on the table.
The pronoun 'That' refers to 'a gun', whereas the omitted pronoun 'there' refers to 'on the table'. In your example 2-, 'That' is short for 'That (there)' as evidenced by the symmetry in ii. directly above.
In sum, and from a strictly structural view, the symmetry is as follows:
- It was a gun.
- It was a gun on the table. :cross: expletive-it
- It was a gun on the table. pronominal-it
- There was a gun on the table.
- That there was a gun on the table.