Margetts got the Daniels back on level terms after Harborough had hit the front early on before netting a second half double to sting the newly-promoted Bees.
The win ensured Stamford followed up their opening day win over Bedworth in the Midlands Division.
Manager Graham Drury had made three changes to his starting line-up with Stacey Freeman, Isaac Currie and Jack Duffy coming in for Joe Burgess, Kern Miller and Connor Furey, who was on the substitutes' bench.
After Saturday's searing heat, the conditions were more like a tropical storm as the heavens opened early on and the rain gathered pace throughout the match.
A lively start saw both sides exchange chances before each scored within two first half minutes.
Cameron Johnson and Margetts both fired shots over for Stamford while the Bees' setpieces were a constant concern for the Daniels with a header going narrowly over the crossbar following Lewis Burgess' long throw.
It was the visitors who then struck first as Sean Wright sent Rhys Hoenes tumbling in the box and James Ireland stepped up to convert the resultant spot kick.
However, the lead lasted just two minutes as Johnson produced some terrific wing play to leave his marker trailing in his wake before crossing to Margetts who was first to react and headed home his first league goal of the campaign.
Home goalkeeper Ben Heath then had to be at his best with a brilliant double save to initially thwart Burgess' free-kick and then block
Hoenes' follow-up.
Harborough continued to threaten from Josh Walsh's corner kicks and one inswinger clipped the top of the crossbar after Heath had tipped another over at full stretch.
A swift Stamford break saw Margetts tee up Will Mellors-Blair who curled his shot wide as the teams went in at half-time on level terms.
Stamford introduced recent recruit Charlie Coppola for the start of the second half and the classy play-maker was at the heart of several good moves.
He produced a teasing run before shooting narrowly wide and then created an opening on the edge of the box before firing straight at goalkeeper Elliott Taylor.
Stamford then took a 54th minute lead as Jack Duffy produced an excellent cross and, as a Harborough player missed the chance to clear, Margetts met the delivery with a sweet first time strike that flew into the far corner of the net
Harborough had an immediate chance to level the contest but an unmarked Ireland hooked his effort over from close range.
And the league newcomers were then taught a harsh lesson with eight minutes remaining as Stamford put the contest beyond their visitors.
A slide-rule pass set Margetts racing clear and he was brought down in the box under Rhys Kelly's challenge.
Kelly - who had been booked in the early exchanges of the match - was shown a straight red card and Margetts confidently converted the spot kick to complete his treble.
Heath again did well to cling onto a low strike from Ireland before Margetts had the chance to score his fourth when Coppola sent him clear but he dragged his shot wide of the far post.
The visitors continued to push and probe until the final whistle but Stamford held the upper hand to celebrate their home league bow with a victory.