Education Secretary John Swinney was warned of pornographic material circulating on a school social networking tool six weeks before a Courier investigation led to access being locked down.
Emails obtained under a freedom of information request reveal the Deputy First Minister was told in April that more than 100 users had been exposed to the explicit content on Yammer, and moderators had no way of knowing who had been affected.
No action was taken to limit access given to young children until The Courier revealed the problems in June.
Mr Swinney was told by Gayle Gorman, chief inspector and chief executive of Education Scotland, that the offending image had been viewed and clicked on by six teachers, four of whom did not raise the alarm with the Scottish Government.
The child whose profile had been used to share the image denied uploading it.
Education bosses said they were investigating whether another individual may have been given access to the account.
The correspondence reveals a media response was drafted in May, although no action was taken by officials at that stage.
It also details education chiefs’ crisis talks on June 11 after The Courier revealed how inappropriate content had again been found on Yammer.
Mr Swinney later told civil servants to rewrite an update to the First Minister before a meeting of the Scottish Cabinet because it was “rather defensive”.
Both the Perth and North Perthshire MSP and Ms Sturgeon had been told on June 7 that a parent from Fife had been in contact via Twitter with evidence of further inappropriate content but that access was still not suspended.
They were warned that “given we have over 60,000 regular users of Yammer… this would cause major disruption for the overwhelming majority of users”.
Access to the social networking tool was finally shut down after The Courier contacted Education Scotland for comment. It has still not been re-established.
After the network was taken down, Mr Swinney blocked its restoration until he could be satisfied the “vulnerability has been restored”.
Scottish Labour education spokesman Iain Gray accused Mr Swinney of failing to act sooner “in a bid to save face”.
He said: “Any government’s primary obligation in office is to protect its children from harm – John Swinney has failed to do so.
“He must now explain why he knew for six weeks that this harmful material was likely being circulated to children but did not intervene until parents’ concerns were about to be reported in the media.”
Scottish Conservative education spokeswoman Liz Smith said the revelations “expose just how slow the SNP government was to act on these acute concerns”.
She added: “It is absolutely right that schools should embrace technology, but we now know that John Swinney was presented with overwhelming evidence that this was not the way to do it.”
An Education Scotland spokesperson said worries can be flagged up on all of its online services, including Yammer, via ”report a concern” buttons.
They added: “The investigation in April was not about parents accessing accounts, it was about pupil’s sharing passwords with peers.
“We must always balance risk with educational benefit. When we decide to suspend a service, we do this with due consideration of the impacts to all users and, in fact, we have had a number of comments from teachers about the adverse impact from the loss of this service.
“We had been in the process of considering our options when we were approached by The Courier and had planned a review for late summer, which was subsequently moved forward.”
The Scottish Government was also approached for comment.