It's impossible to answer a question like this with a definitive no, and it's an interesting notion, but it seems unlikely.
For starters, Lovecraft was never shy of naming his inspirations.
"It is safe to say that Blackwood is the greatest living weirdist despite unevenness and a poor prose style."
- letter to Willis Conover, 10 January 1937
"I think The Yellow Sign is the most fascinating product of Chambers’s pen, & altogether one of the greatest weird tales ever written."
- letter to J. Vernon Shea, 28 January 1933
"Machen is a Titan—perhaps the greatest living author—and I must read everything of his."
- letter to Frank Belknap Long, 3 June 1923
"When I write stories, Edgar Allan Poe is my model."
- letter to Rheinhart Kleiner, 20 January 1916
"Smith is an American Baudelaire—master of ghoulish worlds no other foot ever trod."
- letter to Rheinhart Kleiner, 14 December 1921
Given that he wore his heart on his sleeve when it comes to his opinion of other authors, if Wells had been an major inspiration, we should expect to see mention of him in Lovecraft's correspondence. In fact he does tip hat to Wells, but only once in his famous essay "Supernatural Horror in Literature":
The romantic, semi-Gothic, quasi-moral tradition here represented was carried far down the nineteenth century by such authors as Joseph Sheridan LeFanu, Thomas Preskett Prest with his famous Varney, the Vampyre (1847), Wilkie Collins, the late Sir H. Rider Haggard (whose She is really remarkably good), Sir A. Conan Doyle, H. G. Wells, and Robert Louis Stevenson
Which, you will note, is merely a historical reference rather than an enthusiastic endorsement. He is also lumping Wells in with "gothic horror", which is a different sub-genre to the weird fiction Lovecraft felt his work belonged to.
When you turn to Lovecraft's named inspirations, the other problem with the conjecture in this question becomes clear: "cosmic horror" predates even H.G. Wells.
Take Chamber's The King in Yellow (1895), a series of linked stories about a play which drives people insane. While not "cosmic" in Lovecraftian sense, it deals with similar themes: the inability of humanity to deal with its own narcissism. The "other world" in Chambers is not outer space, but artistic perfection.
A clearer example is Algernon Blackwood whose stories The Willows (1907) and The Wendigo (1910) were regularly praised by Lovecraft. Both have a similar theme of people lost in a vast, uncaring wilderness and encountering there forces beyond their understanding. The nature of those forces is never clear but they are at best indifferent and at worst actively hostile to the protagonists. This is a clear template for much of Lovecraft's work, although again the "other world" is the wilderness in place of a different dimension.
Arguably, however, "cosmic horror" starter earlier with an author not normally seen as a horror writer at all: Franz Kafka. The abiding themes of his work may not be horrific in the traditional sense but are nevertheless disturbing. His protagonists find themselves in dire straits for obscure or inexplicable reasons and, in seeking help, find themselves faced with a bizarre and indifferent bureaucracy. Here the uncaring "other world" is the byzantine machinery of the state.
Lovecraft's lasting legacy is specifying the "other world" of cosmic horror as the cosmos itself. In doing so, he gave a new sense of scale and an aptitude of the fantastic to the concept of humanity facing an uncaring world. These aspects proved a fertile furrow for both Lovecraft and the writers that he, in turn, inspired. But the original concept of the indifferent world predates both Lovecraft and Wells.