I think the punctuation should be as in the last example you used where both the question mark and comma appear within the quotes:
In "Can Pigs Fly?," Bacon states.
For the question mark appearing within the quotations, The Blue Book of Grammar and Puncutation notes:
The placement of question marks with quotation marks follows logic. If
a question is within the quote material, a question mark should be
placed side the quotation marks.
And A Commonsense Guide to Grammar and Usage notes:
The following tip will help you decide where to put question marks and
exclamation points used with quotations.
UNQUOTE TIP Take whatever is inside the quotation marks out of the
sentence and out of the quotation marks. Now, how would you punctuate
this new sentence? If you would use a question mark or an exclamation
point, then this same punctuation belongs inside the closing mark in
the original sentence.
....
Correct Errors in Using Quotation Marks with Other Punctuaton
Update: I often rely on the Grammar Girl for answers to such questions. She has an article Combining Quotation Marks, Question Marks, AND Commas (Whew!) which cites The Chicago Manual of Style:
The Chicago Manual of Style editors make a similar recommendation for
attributions, but take a new stance on titles in their newest edition
(16th edition, section 6.119): they recommend keeping the comma when a
title ends with a question mark or exclamation point, as in the
example above from the Grammar Girl podcast. Therefore, according to
Chicago, which addresses the question most directly, the best way to
write the sentence is as follows:
The Christmas carol we're going to tackle today is "What Child Is
This?," written in 1865 by William Chatterton Dix.