In an entertaining game at the J Davidson Stadium, his second half goals ensured victory for Dale over Altrincham FC.
Rochdale gave their all in a dominant first half but were twice denied by the woodwork and were kept out by a string of excellent saves by ‘keeper Daniel Havern, who deserves the plaudits.
Gillam went on to open the scoring shortly after the hour mark and put the game to bed four minutes from time.
After some good early pressure, Dale carved out their first chance on goal after two minutes. Tyler Berry picked out Matthew Gillam, who sent an effort over the bar from six-yards.
Ten minutes later and Harry Pratt saw a golden opportunity go begging as he scuffed the ball into the hands of Daniel Havern after being unable to make a clean connection.
Dale kept applying the pressure and the Altrincham goalkeeper was called into action shortly after as he tipped an effort on the angle from Gillam round the upright.
Havern again stood between Rochdale and a deserved opening goal as he pulled off a brilliant double save in the 27th minute. He firstly kept out Smalley, before denying Pratt, who struck the follow up.
Two minutes later and the home side had their first and only chance on goal during the half as Dominic Newton got a shot away after travelling through one on one with Diba. The young goalkeeper saved well.
As the half entered its final stages, Rochdale ramped up the pressure but were denied a goal by the excellent goalkeeper and the woodwork.
Havern keep out Pratt at the near post shortly after the half hour mark, before Dale were denied twice by the woodwork within sixty seconds.
Smalley hit the post directly from a corner, while Gillam's shot across goal struck the inside of the upright.
In the 41st minute Pratt was involved again and this time had an excellent strike saved on the line by Havern.
On the stroke of half time the ‘keeper dived to his left, scooping away a shot from Dale full-back Callum Schorah, which looked destined for the bottom corner of the net.
HT: ALTRINCHAM 0-0 ROCHDALE
Rochdale had a couple of half chances shortly after the interval as Gillam headed wide from a Schorah cross, before the full-back hit over the bar from the edge of the area.
Altrincham proved to be more of a threat in the second half, with much of their attacking intent coming through Ashley Leather, who had two efforts on goal in a minute. He curled the first wide of the target, while Diba saved the other after it was struck directly at him.
Dale were comfortable, though, and the deserved breakthrough finally came in the 62nd minute as Gillam found the back of the net after the ball was lashed across the six-yard box.
The first substitution of the match soon followed as Pratt was replaced by Piggott.
Rochdale continued in search of another and in the 76th minute Smalley fired an effort across goal and narrowly wide of the upright.
And it was Gillam who put the game to bed with four minutes remaining as he struck beyond Havern while under pressure.
A trip to Notts County’s Meadow Lane awaits in the next round. A date for the fixture will be announce in due course.
Dale XI: Diba, Mata, Schorah, Kisimba, Coyne, Hollins, Smalley, Berry, Prratt, Lenehan, Gillam. Subs: Stewart, Prescot, Chea, Piggott, Evans.