Is It True that We Can Never Be Sure of Validity of a Mathematical Proof?
Most philosophers have agreed for centuries that we can be completely sure of very little, if anything. Descartes famously argued cogito ergo sum, i.e., that the action of contemplating the possibility of his nonexistence confirms his existence (a nice early example of a "self-defeating proof by contradiction"). This particular argument is no longer thought to be unassailable: see the linked article.
Thus the idea that you cannot be completely sure that a mathematical proof is correct is true, but in the same way that you cannot be completely sure of virtually anything: i.e., in a not very interesting way and one which has nothing to do with mathematical knowledge in particular.
You seem to be arguing that a special feature of mathematical verifications is that they can be long and complicated. I disagree that this is particular to mathematics. Suppose I wanted to create a list of all days between September 1, 2010 and September 1, 2020 in which the temperature in my condo never exceeds 80 degrees Fahrenheit. What a pain in the butt it would be to be even reasonably certain about this: possibly I would want someone to remain in my condo at all times, probably I would want to buy some scientific equipment (I don't trust my thermostat that much, especially to distinguish between 79.5 and 80 degrees); certainly the task will take ten years to complete. This is a long, difficult, esoteric verification that has nothing to do with mathematics.
As I have tried to point out, nothing that you say argues against "we thought that mathematics is the most secure branch of knowledge". You also don't see who "we" are or why we thought that, but as it happens I do think that mathematics is, relatively speaking, an especially secure branch of knowledge. If I spent ten years thinking about the proof of the Poincaré Conjecture, then at the end I would be much more secure in my opinion that it was correct [or, possibly, incorrect!] than I would be at the end of my condo temperature experiment. For PC I would have a coherent, well-understood argument that I could turn around, adapt to other situations, explore consequences of, etc. I could burn all the original documents I read during those 10 years and not be much worse off. For my condo temperature experiment I would just have reams of data and greater or lesser amounts of experimental doubt.
Complicated things are indeed complicated, and I think we must be honest that there is always the possibility (and very often, the reality) of human error. Coming back to Descartes, he believed that he had discovered a method by which it was possible to reason perfectly without error, and he applied his method to develop the new field of analytic geometry. This was fantastic, pioneering work. But entirely without error? Of course not; as is well documented, he made some mistakes. So do almost all of us.
But I would claim that a relatively simple mathematical proof has one of the highest degrees of certainty that we can muster. In another response, someone mentioned the infinitude of prime numbers and indeed there was a previous question on this site with the title "Is it possible that there are only finitely many primes?" When we answer No! we are more sure of this than a researcher in any other field I can think of could be.
I guess the point that mathematicians are trying to make is that a theorem is always valid. However, there may be human flaws in the process, which end up labelling non-theorems as theorems. A scientific model, on the other hand, could be flawed in some (possibly untestable) instances.
In practice, I'm 100% convinced, for example, that Euclid's proof of an infinite number of primes is correct. But for more complicated proofs, errors are reduced by publishing (and in particular, peer review). Some theorems (particularly important ones) have multiple published proofs.
PS. Computer proofs are just as invalid on the philosophical level since humans make computers, etc.
I think there are two issues floating around here. Very complicated informal proofs (i.e. what most mathematicians write, using ordinary languages and verbal reasoning) may indeed contain hard to spot errors. However, a correct proof could, in theory, be translated into a formal language of set theory, say ZFC. Such a proof would be enormous, and might look a lot like machine language (being a combination of symbolic first order logic and the membership symbol of ZFC set theory). But every step of reasoning in such a proof is trivial to verify. Thus, we can in theory check such proofs with computers (or by hand) and be convinced they are correct with very high certainty. Of course, most proofs are not done this way, but there are projects (e.g. Metamath, Mizar, etc.) to formalize large parts of mathematics. I think this is what you are getting at with your question.
The second issue, however, is the more complex question having to do with Godel incompleteness. In brief, to construct a formal proof, we need a foundation, which is typically ZFC set theory. But by incompleteness, we cannot know that ZFC is consistent inside of ZFC! Most set theorist strongly believe ZFC is consistent, however, as no one has ever exhibited an inconsistency. So mathematicians tacitly assume that ZFC is consistent, and from that assumption write proofs. In set theory itself, you often see proofs that read "Assuming ZFC is consistent, X is true." But by contraposition, this yields the tantalizing possibility that we might find, via other means, that X is false, and thus that ZFC is inconsistent! This would be an absolutely explosive event in mathematics, of course. I don't think this is what your question was getting at, but I thought it would be useful to know that there is indeed a "fundamental" incompleteness issue floating around here.